By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,579 Members | 1,790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,579 IT Pros & Developers. It's quick & easy.

Copy File(s) by System.Diagnostics.Process

P: n/a
Hi,

How would I copy the file 'test.txt' from C:\_A to C:\_B.
I need this through the System.Diagnostics.Process-Class and NOT the
IO.File-Class

p = New System.Diagnostics.Process()
p.StartInfo.FileName = "cmd.exe"
p.StartInfo.Arguments = "copy C:\_A\test.txt C:\_B > nul"
p.StartInfo.CreateNoWindow = True
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
p.Start()

This snippet doesn't work.

TIA,

Michael
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
OK, forgot the /K

p.StartInfo.Arguments = "/K copy C:\_A\test.txt C:\_B > nul"
"Michael Maes" wrote:
Hi,

How would I copy the file 'test.txt' from C:\_A to C:\_B.
I need this through the System.Diagnostics.Process-Class and NOT the
IO.File-Class

p = New System.Diagnostics.Process()
p.StartInfo.FileName = "cmd.exe"
p.StartInfo.Arguments = "copy C:\_A\test.txt C:\_B > nul"
p.StartInfo.CreateNoWindow = True
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
p.Start()

This snippet doesn't work.

TIA,

Michael

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.