How can I use PowerShell's Start-Process
cmdlet to start a process using its full command line (with executable path and arguments). For instance let I have the following line
"<dir_path>/myprog.exe" -arg1 "val1" -arg2 "val2"
stored on some string variable and want to run it via Start-Process.
I know that Start-Process -FilePath '<dir_path>/myprog.exe' -ArgumentList '-arg1 "val1" -arg2 "val2"'
will work. But the point is that I don't know how to get executable's path and arguments from the full command line.
So is there some way to run process using its full command line via Start-Process
, or if there is no such way, then how can I get file path and argument list from the command line?