I need a Shutdown command with prompt
Moderator: DosItHelp
I need a Shutdown command with prompt
I want to create a shutdown command using a batch script that will prompt me for the computer name. I have been using this cmd line {shutdown /m \\mycomputer /s /t 0} to restart a computer on my network. It works great. I have to keep changing the mycomputer to whatever computer I am targeting. I was wondering if someone knew of a way to create a batch script that would run a cmd prompt that would ask you what computer name you are targeting?
Re: I need a Shutdown command with prompt
I think this is the sort of thing you are talking about:
phillid
Code: Select all
@echo off
:: ask the user for computer name
:prompt
echo Computer Name:
set /p "comp_name=> "
::Check for blank input variable
if not defined comp_name (
echo Please enter a computer name!
goto prompt
)
::Shut the remote machine down
echo Shutting down %comp_name%
shutdown /m \\%compname% /s /t 0
echo.
pause
phillid
Re: I need a Shutdown command with prompt
Looks like exactly what I need. Thanks very much!