Link to home
Start Free TrialLog in
Avatar of mhamer
mhamer

asked on

logon script issue (easy if you know)

We have a logon script that has to run as it does, but half way through I would like it to exit if %computername% = mycomputer

i have played around and it just exist all the time on every computer
i was thinking of
IF not %computername% "==" goto exit but no joy

windows 2003
ASKER CERTIFIED SOLUTION
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SteveGTR shows the right statement, but to explain a little.
exit is a specific command which you cannot use as you are trying to.

You have to use the goto command with a label. To let the above make a little more sense

IF "%computername%"=="mycomputer" goto :EOF
<statements put here will be excuted if computername is NOT equal to mycomputer>

:EOF
<statements put here will be excuted if computername IS equal to mycomputer>
ThePrutser, please don't post if you have nothing new to add. Not only is your information just a restatement of my information it is incorrect as :EOF is a predefined label that does not need to be specified.
Avatar of mhamer
mhamer

ASKER

Thaks  but im ok with the lables bit, just had " in wrong place

cheers
Steve, I am sorry about the incorrect info of the :EOF. I only want to make sure the post was familiar with labeling in batch files. Your correct answer was a little short of explaination according to me. If a novice user would read your reply (found by google or whatsoever), I can imagine he does not understand your answer completely. Just trying to help, sorry if I offended you.