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
mhamerAsked:
Who is Participating?
 
SteveGTRConnect With a Mentor Commented:
IF "%computername%"=="mycomputer" goto :EOF
0
 
Erik NettekovenTechnical ConsultantCommented:
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>
0
 
SteveGTRCommented:
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.
0
 
mhamerAuthor Commented:
Thaks  but im ok with the lables bit, just had " in wrong place

cheers
0
 
Erik NettekovenTechnical ConsultantCommented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.