• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

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
0
mhamer
Asked:
mhamer
  • 2
  • 2
1 Solution
 
SteveGTRCommented:
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now