alex.s alex.s - 2 months ago 6
Vb.net Question

VB.net how to pass the following to cmd

Can someone help me please to write it correctly in Vb.net.

.bat file looks like this:


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

AzCopy /Source:https://projects.table.core.windows.net/table/ /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

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:https://projects.table.core.windows.net/table/ /Dest:C:Users\user\Downloads\ /SourceKey:key"
p.Start()

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

Comments