alex.s alex.s - 1 year ago 105 Question how to pass the following to cmd

Can someone help me please to write it correctly in

.bat file looks like this:

CD "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy"

AzCopy /Source: /Dest:C:Users\user\Downloads\ /SourceKey:key

I can use Process.Run and just run the bat file but I need more flexibility with user names, paths and access keys that are in the string.

Answer Source

You can pass arguments to process calls, yours would look something like this:

Dim p As New System.Diagnostics.Process
p.StartInfo.FileName = "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy"
p.StartInfo.Arguments = "/Source: /Dest:C:Users\user\Downloads\ /SourceKey:key"

Just build the arguments string with whatever parameters you need to pass to the file

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download