How to run exe available on shared drive using command prompt

14.7k Views Asked by At

I have a exe available on shared drive example "\domain.com\folder\test.exe"

How to access this path using command prompt and execute exe.

I tried "net use y: \domain.com\folder" command. It created network drive but dont know how to execute exe.

1

There are 1 best solutions below

0
On

You can reference the executable directly using a UNC path wrapped in quotes, such as

"\\server\share\path\file.extention"

The \\ at the beginning denotes it's a UNC path wrapping it in quote sis just good practice in case there are any spaces in the path.

"\domain.com\folder\test.exe" will work UNLESS the test.exe file needs to have it's cmd environment local to the program itself because it doesn't properly set itself on run.

in which case you might prefer to use:

MKLINK /D "C:\Link" "\\domain.com\folder"
CD "C:\Link"
test.exe

OR

net use y: "\\domain.com\folder"
CD /D "Y:\"
test.exe

OR

PushD "\\domain.com\folder"
test.exe
PopD

OR

MKLINK /D "C:\Link" "\\domain.com\folder"
MKLINK /J "C:\Junction" "C:\Link"
CD "C:\Junction"
test.exe

I prefer this final method but only because I use some of the features windows enables on junctions in the Explorer details, and does not enable on symbolic links.