Reputation: 1967
I'm just interested in knowing: can we shutdown a PC from another PC using a batch file if both are on the same LAN?
Upvotes: 1
Views: 47935
Reputation: 213
Easiest way:
set computertoshutdown=COMPUTERNAME
set timetoshutdown =TIMEtoSHUTDOWN
set message=MESSAGE
shutdown -s -m \\%computertoshutdown% -t %timetoshutdown% -c "%message%"
Upvotes: 1
Reputation: 1
This should work but you can shutdown any computer in your wifi range to find the name of the computer press the Win+Pause+Break keys all at the same time then go to computer name.
@Echo off
cd\
Echo Saman=Program
REM ****************************
REM * Program Variables *
REM ****************************
set varcomputer=[computername]
goto loop
:[computername]
Exit
REM ****************************
REM * Program *
REM ****************************
:loop
echo Shutting down %varcomputer%.
shutdown -s -m \\%varcomputer% -t 600 -c "The computer is shutting down. Please save your work."
goto %varcomputer
Upvotes: 0
Reputation: 31221
Yes, you can use the /m
switch for shutdown
like this
shutdown /s /m \\computer1 /t 0
Upvotes: 4
Reputation: 175766
Call the shutdown command from a batch running as a user with the correct permissions or use psshutdown.
Upvotes: 3