Amith
Amith

Reputation: 1967

Shutdown a PC on LAN from another PC using a batch file in Windows 7

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

Answers (4)

rebane2001
rebane2001

Reputation: 213

Easiest way:

set computertoshutdown=COMPUTERNAME
set timetoshutdown =TIMEtoSHUTDOWN
set message=MESSAGE

shutdown -s -m \\%computertoshutdown% -t %timetoshutdown% -c "%message%"

Upvotes: 1

armyguy556
armyguy556

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

Bali C
Bali C

Reputation: 31221

Yes, you can use the /m switch for shutdown like this

shutdown /s /m \\computer1 /t 0

Upvotes: 4

Alex K.
Alex K.

Reputation: 175766

Call the shutdown command from a batch running as a user with the correct permissions or use psshutdown.

Upvotes: 3

Related Questions