shortcut to program files (x86) directory

10,749

Solution 1

Put quotes around your path. Like so:

silent ! start "c:\Program Files (x86)\Windows NT\Accessories\wordpad.exe" "%:p"<CR>

Solution 2

On 64-bit Windows wordpad.exe won't be in "Program Files (x86)", but in "Program Files". At least it is on my machine.

There are environment variables to find the folder names: "%ProgramFiles%" and "%ProgramFiles(x86)%".

Solution 3

Vim on Windows has a special !start (without a space in between) for asynchronous invocation.

And, as always, you need to put double quotes around the path, like this:

silent !start "c:\Program Files (x86)\Windows NT\Accessories\wordpad.exe" "%:p"
Share:
10,749
Reman
Author by

Reman

Updated on July 25, 2022

Comments

  • Reman
    Reman almost 2 years

    On my win32 system I had this command in Vim to open a vim file in wordpad:

    silent ! start c:\Program Files (x86)\Windows NT\Accessories\wordpad.exe "%:p"<CR>
    

    On my win64 system this doesn't work. I get this error:

    error: Windows cannot find `"c:\Program"`
    

    Maybe because of the space(s) inside "Program Files (x86)" and "Windows NT"?

    How can i resolve this problem?