2

Here is the command I try to execute:

runas /netonly /user:DOMAIN\user "cmd /k C:\Program Files (x86)\program.exe"

When i try to execute it I have the following error message:
'C:\Program' is not recognized as an internal or external command, operable program or batch file.

As the following commands work:

runas /netonly /user:DOMAIN\user "C:\Program Files (x86)\program.exe"
cmd /k """C:\Program Files (x86)\program.exe"""

I also try this command:

runas /netonly /user:DOMAIN\user "cmd /k """"""C:\Program Files (x86)\program.exe"""""""
# bad syntax

runas /netonly /user:DOMAIN\user "cmd /k \"C:\Program Files (x86)\program.exe\""
# The term 'x86' is not recognized

I didn't manage to find the right used of double quotes to make my command run.

1 Answer 1

3

One way is to use the short pathname, e.g.

runas /netonly /user:DOMAIN\user "cmd /k C:\Progra~2\program.exe"

dir /x will give both the short and the long filename.

1
  • I didn't know the dir /x command to know the path short name. Thanks a lot, you solved my problem.
    – Nicolas
    Mar 20, 2020 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .