Launch CMD on remote computer

I'm trying to launch a command window on a remote computer.  The way it works on the local computer is that I have a .bat file that I can double click or run from a cmd window and it runs a .exe.  I have used Remote Desktop to log into the remote computers and set up the command window there and launch the .bat file and that is exactly what I want, its just just that I'd like to automate it and avoid remote desktop.  I've tried PSEXEC, but that gives me a command window on my PC that operates on the remote PC.  I want the actual command window to pop up on the remote computer instead of the local computer.

Thanks for the help
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

brou0040Author Commented:
No I haven't looked at it before.  I'm trying to keep everything either MATLAB or DOS, maybe use 3rd party if I have to.  I was dissipointed by the first few lines of the link "Windows XP or Windows Server 2003. On those two versions of Windows any processes started remotely run in a hidden window: those processes cant be interactive because the user will never see them."  I see they provided a workaround, but I don't understand the purpose of Interactive.vbs.  You could just schedule the .bat file and bypass the entire Interactive.vbs.  I have done this before using the AT command, but I was trying to find a more direct method than scheduling.
Is this something that you want to run automatically on boot?  I guess I don't completely understand what you are trying to accomplish.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

brou0040Author Commented:
No it's not at boot, here's a little more info.

It is sort of a batch scheduler.  I had looked into 3rd party ones, but they don't provide what I need.  I made my own and it's really basic and easy.  The 3rd party schedulars still have the problem of not having the cmd window on the remote PC.

I have a list of .bat files that need to be run and a list of PCs that are on my network.  When a PC becomes free, I want the next .bat in the que to be launched on that PC.  Since I don't want a million cmd windows on my screen I want the cmd windows to pop up on the individual PCs and I'll remote desktop into them if I need to check the progress of a specific .bat.  There are several user PCs (me being one of them) and several work PCs that just run .bats for us.  I'm not an IT guy, but we'd probably be better off with server, but this is what we're stuck with, all XP Pro PCs.  Other users have to be able to access the .bat cmd windows as well without coming to my PC or using remote desktop to my PC.  They can remote desktop into specific .bat files on the remote PCs as long as there is only 1 person looking at a time.
PsExec v1.92

psexec \\remotepc cmd.exe

Or against your file of pcnames, saved at c:\names.txt

psexec @C:\names.txt -d yourapp.exe

If the app is not on the target already, use the following, but the app needs to be in your directory where psexec is launched form...

psexec @C:\names.txt -c -d yourapp.exe

And for the cmd window to show onscreen on the target.....

psexec @C:\names.txt -c -d -i yourapp.exe
Re read the post, and pay special attention to the "-i" switch....


Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session.
brou0040Author Commented:
I've already tried psexec, it'll launch a process on a remoter computer and it will be interactive with the -i switch, but it will not launch a command window on the remote pc.

The original question is not how to launch a remote process, but how to launch a window on a remote PC.  The remote command window should be no different than if I had used remote desktop and started remote destop and launched a .bat file.

"I've already tried psexec, it'll launch a process on a remoter computer and it will be interactive with the -i switch, but it will not launch a command window on the remote pc."

psexec \\remotepc -i cmd.exe

Does just this...... But whats odd, is I have no output to the second command window.... One of the few commands I have never tried interactive on the target system.... Odd....

Wonder if there is anything at the Sysinternals forums about that?

I know if you launch the .bat remotely with the -i switch it shows on screen.... I wanna find this answer now....

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brou0040Author Commented:
johnb6767, i tried PSEXEC with the -i flag before and it didn't work, that is what I explained in the first post.  Maybe it is a different version of PSEXEC I'm using now (from your link) because it has comments for Vista in it.  I now have exactly what I want, a window that pops up on the remote machine.  I have the output showing up on the remote machine and it is interactive on the remote machine.

Now that I got it working, I've got a new problem that came up.  I can't seem to manage to redirect the output of the command window while maintaining the output on the window itself.  It seems like I get one or the other...
A new problem for another day...
An interesting problem !
... but after some experimentation, the following code segment worked for us:
   " ... \\remotepc cmd.exe /C x:\xxx\zzz.bat"
where "x:\xxx\zzz.bat" is the absolute path of an executable *.bat file on "\\remotepc" ...

With some further experimentation, this core segment also works in TFS Build.  
I caution though that finding a combination of switches, arguments, paths, local and remote privileges, etc. for both PSEXEC, and TFS BUILD,  that works in your particular environment, could be an art of "computer gamesmanship" ... (smile).  

For instance, particularly for TFS BUILD, any incorrect combination may often result in the build hanging at your PSEXEC command line.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.