Run a batch file on a remote computer
remote_batch.cs
Just edit the Arguments. Keep the /C and type the complete path to your batch file. As the path is a c-sharp string, you must double the \ such as in the example.
remote_batch.cs
#USING System.Diagnostics
void Main( object param )
{
ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.FileName = "CMD.EXE";
processStartInfo.Arguments = "/C c:\\path\\to\\my_batch_file.bat";
processStartInfo.WindowStyle = ProcessWindowStyle.Maximized;
Process.Start( processStartInfo );
}
void Main( object param )
{
ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.FileName = "CMD.EXE";
processStartInfo.Arguments = "/C c:\\path\\to\\my_batch_file.bat";
processStartInfo.WindowStyle = ProcessWindowStyle.Maximized;
Process.Start( processStartInfo );
}
Comment