Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi
I’m creating a login script, but having a little bit of trouble with this section.
The login script isn’t very flashy, but works all the time, just a few net views..etc.etc..
I thought to stop running this everyday for a user I would enter a registry key in current user
Something like this
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\login]
"loginscript"="1"does anyone know a quick line in command line batch scripting that would say.
If [HKEY_CURRENT_USER\login]
"loginscript"="1" existsgoto end: of script?
I’ve looked at the tools that are provided, would reg query be the best, but then I’m not sure how to get the value 1 and if there drop the script out to the end.
Hope this makes sense..
Thanks in advance
Geoff

I think the easiest way to do this would be using this snippet from a login script:
REG ADD HKCU\loginTest /v loginscript /d 1 /fREG COMPARE HKCU\loginTest HKCU\login /v loginscript
IF "%errorlevel%"=="0" EXIT
What it does is first create a test key (HKCU\loginTest). By setting it to a "1" we can then do a REG COMPARE and use the return value (stored in %errorlevel%) to determine if the HKCU\login is the same. If it is any other value or does not exist then %errorlevel% will not be equal to "0". So if
%errorlevel% IS equal to "0" then it means that HKCU\login\loginscript is equal to "1" and we can exit the script with the EXIT command.How's that? You might need to change the registry key values if you want to check something besides HKCU\login.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |