Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I transfer (upload) the batch file to the server using FTP in C# (FtpWebRequest). Batch files have some commands. My requirement is to transfer the batch file to the server (which I am able to do) and execute that batch file.

How do I execute the commands in the batch file on the server from my client? Can I use Process.Start() approach or rsh?? Which is better way of doing it and a link to the example would be appreciated.

Thanks,
Nayan
Posted

1 solution

Be very careful here - just because the batch file is physically stored on the server does not mean that you are executing the commands on that server!

If you google for execute remote command windows you will get several links to ways of achieving this... here's a few ...

Personally I use psexec from sysinternals - http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx[^]

but I know some people have used WMIC - http://technet.microsoft.com/en-us/library/bb742610.aspx[^]

and others prefer Powershell - http://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900