Linux-Noob Forums
batch file noob - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Windows Noob (https://www.linux-noob.com/forums/forum-5.html)
+--- Forum: How Do I? (https://www.linux-noob.com/forums/forum-70.html)
+--- Thread: batch file noob (/thread-2255.html)



batch file noob - arbalest - 2006-01-13


How would I shut down a networked computer remotely, with a batch file? Im guessing it has something to do with ending the svchost.exe process. I can get to another computer, with a simple:

 

@echo off

start \\"network name"-"computer name" \c$\

 

and im able to view the files.

 

but I dont know how to run a command on that computer, let alone shut it down. So if anyone could give me some helpful tips, it would be greatly appreciated. Other fun things to do with batch files on networks would be awesome as well.




batch file noob - dspln - 2006-01-13


AFAIK, what you posted will let you execute remote programs on the local computer - not what you want.

 

To just shutdown/reboot a computer I guess you could use shutdown :)



Code:
E:\>shutdown /?
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]

    No args                 Display this message (same as -?)
    -i                      Display GUI interface, must be the first option
    -l                      Log off (cannot be used with -m option)
    -s                      Shutdown the computer
    -r                      Shutdown and restart the computer
    -a                      Abort a system shutdown
    -m \\computername       Remote computer to shutdown/restart/abort
    -t xx                   Set timeout for shutdown to xx seconds
    -c "comment"            Shutdown comment (maximum of 127 characters)
    -f                      Forces running applications to close without warning
    -d [u][p]:xx:yy         The reason code for the shutdown
                            u is the user code
                            p is a planned shutdown code
                            xx is the major reason code (positive integer less than 256)
                            yy is the minor reason code (positive integer less than 65536)




 

I used to use rcmd (from NT Resource kit) for arbitrary remote commands:



Code:
E:\bin\NTRESKIT>rcmd /?

Usage: rcmd [server_name [command] ]

Prompts for server_name if  not supplied.   Session is
interactive and is terminated by ctrl-Break or Exit of
remote shell.   Program is terminated by ctrl-Break or
ctrl-C when no session is in progress.

If no command supplied,  session is interactive and is
terminated by ctrl-Break  or Exit  of remote cmd shell

If command is supplied,  remote shell executes  single
command on specified server and exits.

Note : Command line server_name requires leading '\\'s







batch file noob - arbalest - 2006-01-14

thanks alot.