c# - Process.Start() arguments does not take effect -


i have code here in c#, function of generate list of files in folder:

processstartinfo processstartinfo = new processstartinfo("cmd.exe", "dir /b /s *.* > d:\\tempf.txt"); processstartinfo.workingdirectory = @"c:\test"; process.start(processstartinfo); 

this run cmd on c:\test , arguments not executed. there missing?

you need /c argument "execute rest command":

processstartinfo processstartinfo = new processstartinfo("cmd.exe",     "/c dir /b /s *.* > d:\\tempf.txt"); 

from cmd:

/c      carries out command specified string , terminates 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

c# - Farseer ContactListener is not working -

Automatically create pages in phpfox -