[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 513
  • Last Modified:

Run a batch file

I have several computers that are Windows 7 on a Windows 2008 domain. I'm testing a senerio & need to be able to run a .bat file on a remote computer. I've already placed two files on the remote computer via \\\ipaddress\c$

These two files on on the C drive of the remote computer. One file is named 1.bat & the other is 2.html

The 1,bat file executes the 2.bat file if I am sitting in front of the computer but I need to execute the 1.bat file from a remote location...is this possible? If so, how?
0
wantabe2
Asked:
wantabe2
  • 4
  • 3
1 Solution
 
wantabe2Author Commented:
OK, I've just discovered PSEXEC. If I'm sitting at my computer at the c:\pstools prompt how can I run the 1.bat file from here if the 1.bat file is located on \\156.32.26.45\c$
0
 
CrowaXCommented:
psexec \156.32.26.45 "c:\1.bat"

That should do it for you. Here are some other examples on how to use it.

http://ss64.com/nt/psexec.html
0
 
wantabe2Author Commented:
I'm trying to run it & keep getting c:\1.bat exited on IPADDRESS with error code 0

any suggestions?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
wantabe2Author Commented:
Does PSEXEC need to be installed on the remote computer as well
0
 
CrowaXCommented:
error code 0 usually means it completed successfully. Check the remote machine and be sure it didnt run. Also, I usually use the computer name and not the IP, but I think both work fine. You do not need psexec on the other computer.
0
 
wantabe2Author Commented:
I'm trying to opn IE & go to a specific website...

Below is my cmd I'm using in the batch file but it is not working...

c:\"program files"\"internet explorer"\iexplore http://thesite/wt.html

Instead of going to the site, IE tries to go to:

http://files%22/%22internet%20explorer%22/iexplore%20%20http://thesite/wt.html

in the address bar...what am I doing wrong?
0
 
CrowaXCommented:
The problem is your quotes. Put it around the entire file location, like so.

"c:\program files\internet explorer\iexplore" http://thesite/wt.html
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now