Announcement

Collapse
No announcement yet.

Remote Script Gallery

Collapse
This topic is closed.
X
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    Run a batch file on a remote computer

    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 );
    }
    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.
    --
    stipus

    Comment

    Working...
    X