Ausführen von Multiline -Befehl von *.cmd -Datei aus C# CodeC#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Ausführen von Multiline -Befehl von *.cmd -Datei aus C# Code

Post by Anonymous »

Ich habe eine Datei in E Drive E: \ 1 \ 2 \ abc.cmd und folgende Zeile, die in dieser Datei geschrieben ist < /p>

Code: Select all

@:again
@..\xyz.exe  param1 param2
@goto again
< /code>

xyz.exe path ist e: \ 1 \ xyz.exe < /p>

Wenn ich auf ABC.cmd doppelklicke, funktioniert es gut, aber es wirft eine Ausnahme aus, wenn ich das Formular C# ausführen kann. Sagen ".. \ xyz.exe wird nicht als interner oder externer Kommad erkannt" < /code>.System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.FileName = @"E:\1\2\Abc.cmd";
process.StartInfo = startInfo;
process.Start();

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post