Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7610897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:31:49+00:00 2026-05-31T01:31:49+00:00

I have not worked with DOS much as there were always shell scripting in

  • 0

I have not worked with DOS much as there were always shell scripting in Unix which were more powerful. First time I am working on Windows and don’t know much about the DOS/Batch script.

I was trying to write a small script to restart the remote machine.
While making script sophisticate, I learned about the environment var %ERRORLEVEL%, which is kind of return code from the last ran command.

In Unix if command run but not produce the desire result or some error msg, error code is not zero.
As I am trying remote shutdown and providing host which does not exists in the network. It says that “Network path not found” but %ERRORLEVEL% is still zero. Which is whole point to asking this question.

Do I need to capture something other then %ERRORLEVEL%, as Zero is designated to ran successful command and it is not changing the %ERRORLEVEL% when throwing “Network path not found” what should I capture to get this right ?

shutdown command I am using: 

shutdown -r -f -t %DELAYOF% -m \\%COMPNAME% -c %COMMENT%

When I give invalid value gives to %COMPNAME%, it prompt says “network path not found” but %EERORLEVEL% is not being changed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:31:51+00:00Added an answer on May 31, 2026 at 1:31 am

    The answer to your problem -the error level is that %compname% is not an environmental variable, however %computername% is.

    Try this: (not tested)

    shutdown -r -f -t %DELAYOF% -m \\%COMPUTERNAME% -c %COMMENT%
    

    If this isn’t what you’re looking for can you please post your script so that we can take a look at it, at least the parts that are relavant to this snippet.

    As for the %ERRORLEVEL% try to put this in front of your command

    verify >nul
    shutdown -r -f -t %DELAYOF% -m \\%COMPNAME% -c %COMMENT%
    echo.%ERRORLEVEL%>yourfile.txt
    

    The verify >nul will keep your errorlevel blank so that you don’t capture it from somewhere else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have not worked with parameters in ADO.Net very much. I'm writing a custom
I have not worked so much with files: I am wondering about possible issues
I am working on a Java project for class and have not worked much
Have not worked with ASP in a very long time and have never dealt
I have not worked with XML much so this may be a basic question
I have not worked with arrays much in PHP. I have a table of
I have not worked much on virtual machines and I need some help in
I'm ashamed to say it, but I have to. I have not worked with
So I've never worked with stored procedures and have not a whole lot of
I have worked on iPhone application but not aware of the formalities to submit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.