3

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?

3 Answers 3

7

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)%".

3

Put quotes around your path. Like so:

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

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"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.