Need to create a batch file using if and else

5 pts.
Tags:
MS-DOS
URGENT
Hi 
pls. can anybody help
i need to create a file in which i need to compare the hostname with the my given hostname
which if matches calls another batch file..else echos a msg
pls. can somebdy guide
i am new to batch files



Software/Hardware used:
MS DOs
ASKED: February 2, 2014  5:18 PM
UPDATED: February 6, 2014  4:40 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • FTClark

    Sounds like a homework question? Nobody in the real world is using MSDOS. I am guessing you mean the Windows Command Line Interpreter. This is similar to MSDOS but is not the same thing. Assuming you are a trained programmer then refer to:

    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true

    If you are not a trained programmer then you will not understand the answer anyway.

    if %computername% == MYCOMPUTER goto :rightcomputer
    echo This CMD script is designed to run on MYCOMPUTER!
    echo.
    pause
    goto :eof

    :rightcomputer


    730 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following