We help IT Professionals succeed at work.

logon script  issue (easy if you know)

352 Views
Last Modified: 2010-03-05
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
Comment
Watch Question

Top Expert 2007
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Erik NettekovenTechnical Consultant

Commented:
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>
Top Expert 2007

Commented:
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.

Author

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

cheers
Erik NettekovenTechnical Consultant

Commented:
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.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.