logon script  issue (easy if you know)

Posted on 2007-10-02
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
Question by:mhamer
    LVL 30

    Accepted Solution

    IF "%computername%"=="mycomputer" goto :EOF
    LVL 1

    Expert Comment

    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>

    <statements put here will be excuted if computername IS equal to mycomputer>
    LVL 30

    Expert Comment

    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 Comment

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

    LVL 1

    Expert Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Suggested Solutions

    In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
    In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at (http://www.experts-ex…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now