Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you start a program stored on a UNC share from the command line with parameters?

There's an in-house program we use and it's stored on a UNC share so that updates are transparent. I'd like to supply it some command line parameters like so:

\\server\share\in_house_thingy.exe myusername mypassword

But I can't seem to get it to work in either CMD or PowerShell or via a shortcut.

Anyone got any ideas?

like image 394
Josh Kodroff Avatar asked Dec 23 '22 13:12

Josh Kodroff


2 Answers

You could use:

$app = '\\server\share\in_house_thingy.exe'
$arguments = 'myusername mypassword'
$process = [System.Diagnostics.Process]::Start($app, $arguments)

The $process object will give you a live process object if you want to get an exit code or other information from that process.

like image 184
Steven Murawski Avatar answered Jan 19 '23 01:01

Steven Murawski


For a shortcut, change the target to be like:

"\\server\share\in_house_thingy.exe" myusername mypassword

unless you really do want to have to use powershell to make this work.

like image 38
Orihara Avatar answered Jan 19 '23 00:01

Orihara