I have a .bat hosting on a windows server.
Server name: ServerDb.
.bat address: D:\Folder1\Scripts\Launcher.bat
locally I can run a bat like this:
System.Diagnostics.Process.Start(@"c:\iccmsdos\test\xload2.bat");
but I don't know how to run the .bat on the server from the client. Any suggestion?
Here I leave how I solved it:
First download PSTools where the PSExec.exe comes that helps to execute remote processes.
I will try to emplicate the code that is little but it helped me to solve my presented problem.
in the server variable I assign the name of the server or the IP, then we initialize processstartinfo in the Filename property we load from the path where the application starts the PSExec.exe, I decided to copy the exe to the root folder and I obtain the path with Path. Combine, in the Arguments property I add the user and password with which the process will be executed, this is very important, the user must have administrator permissions, we also pass the path of the .bat and the name of the server.
With process.start() we command to execute the process on the server and that's it!
I hope someone else will help.
Greetings.