Copy File(s) by System.Diagnostics.Process

G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top