.net - CMD Commands won't run in C# -
I am trying to run the following:
string command = @ " C: \ user \ some \ documents \ generated_files \ r ++ + "+ folder"; System.Diagnostics.Process.Start ("CMD.exe", "/ K Path C: \\ Program Files \ \ R3.1.1 \\ bin;% path% "); System.Diagnostics.Process.Start (" CMD.exe "," / K "+ command); when I execute it, then nothing happens, does anyone know why? If I try,
System.Diagno Stics.Process.Start ("CMD.exe", "/ K MD test"); This works fine: s
E: Some additional information , The first command is setting the path, so that the router can be called by typing the router. Besides, these two commands work when I do them in normal CMD interface.
Prepare a batch file and execute it using
(StreamWriter sw = new StreamWriter ("runcript. cmd ", incorrect)) {sw.WriteLine (@" PATH C: \ Program Fi les \ R \ R-3.1 1 \ bin;% Path% "); Sw.WriteLine (@" RuPut C: \ Users \ Any \ Documents \ generated_files \ ". + + +" + + "+ + Folder);} System.Diagnostics.Process Start ("CMD.exe", "/ k runcript.cmd"); Believes that you have given permission to read / write to the current directory. >
string path = environment can be changed to more suitable condition by using the gatefolder path (environment specialfolder.appplicationdata); string file cmd = path. Using Bain (path, "Rnskript. Cmd"); (StreamWriter sw = new streamers (file CMD, wrong) ....
Comments
Post a Comment