Jump to content
Sign in to follow this  
arbalest

batch file noob

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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 :)

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:

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

Share this post


Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...