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 8855841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:13:35+00:00 2026-06-14T14:13:35+00:00

I intend to use the code below to shutdown or restart a computer. Every

  • 0

I intend to use the code below to shutdown or restart a computer. Every time I run this, it goes back to set /p var=Type computer name here: Can you please tell me, what is wrong with my script and how to fix it?

@ECHO off
set /p var=Type computer name here: 
cls
TITLE %var% power control!!!!
ECHO Copyright © Joshua Reynolds 2012
ECHO USE THIS PROGRAM AT YOUR OWN RISK
pause
:start
cls
ECHO Choose an option below:
ECHO 1. Shutdown
ECHO 2. Restart
ECHO 3. Abort previous choice
ECHO 4. Exit
set /p choice=Type the options number: 
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto shutdown
if '%choice%'=='2' goto restart
if '%choice%'=='3' goto abort
if '%choice%'=='4' exit
cls
ECHO "%choice%" is not a valid option please try again
ECHO.
pause
goto start
:shutdown
COLOR 4f
cls
ECHO To shutdown %var%
pause
shutdown /s /m \\%var%
ECHO %var% should now shutdown.
goto start
:restart
COLOR A0
cls
ECHO To restart %var%
pause
shutdown /r /m \\%var%
ECHO %var% should now restart.
goto end
:abort
COLOR 5f
cls
shutdown /a /m \\%var%
goto end
:end
pause
COLOR 0f
goto start
  • 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-06-14T14:13:37+00:00Added an answer on June 14, 2026 at 2:13 pm

    Perhaps the name of your batch script is shutdown.bat and it is in your current directory. So when your script tries to run the SHUTDOWN command, it re-runs your batch script instead.

    Either change the name of your script, or else explicitly use shutdown.exe within your script whenever you want to invoke the command.

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

Sidebar

Related Questions

I use a TabHost. The below code to call AActivity. intent = new Intent().setClass(this,
I want to send an SMS via intent, but when I use this code,
I use tabhost in my app. I use below code to add intent: TabHost
I am attempting to use the MediaStore.ACTION_VIDEO_CAPTURE in my app, see code below. However,
Please can anyone help me out with this problem? This code below works perfectly
I use the code below to do the operation. Intent action = new Intent(Intent.ACTION_GET_CONTENT);
I use the code below to send an e-mail to may e-mail address. When
I use below code to open .doc file by call other application. But I
I use below code to get image file path and it thumbnail. String[] projection
I try use below code to load an URL. URL url = new URL(urlstr);

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.