We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Run a batch file

Medium Priority
524 Views
Last Modified: 2012-05-11
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?
Comment
Watch Question

Author

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$

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

Author

Commented:
I'm trying to run it & keep getting c:\1.bat exited on IPADDRESS with error code 0

any suggestions?

Author

Commented:
Does PSEXEC need to be installed on the remote computer as well

Commented:
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.

Author

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?
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.