Wednesday, April 27, 2011

Re: execute command from vim in windows

On 27/04/11 19:39, cyboman wrote:
> i need to run an executable from vim. the problem that i'm facing is
> that directory names in the path to this file contain spaces and vim
> doesn't recognize that.
>
> here is the problem
> C:\Documents and Settings\myhomedirectory\someotherdirectory
> \executable.exe
>
> when i execute from vim
> !C:\\Documents\ and\ Settings\\myhomedirectory\\someotherdirectory\
> \executable.exe
>
> i get the following message
>
> C:\\Documents
>

One of the ways to avoid spaces in Windows names of files and
directories is to replace any "controversial" names by their 8.3
equivalents: for instance,

:!C:/DOCUME~1/myhomedirectory/someotherdirectory/executable.exe

or even

:!C:/PROGRA~1/foo/foo.exe C:/DOCUME~1/luser/MYDOCU~1/bar.txt

-- the latter is a program name with a file as argument, and would do
the same as running

"C:\Program Files\foo\foo.exe" "C:\Documents and Settings\luser\My
Documents\bar.txt"

at the cmd.exe prompt. As you can see, 8.3 elements and LFN elements can
be used in a single path. Also (if 'shellslash' is off, which is the
default) you can use forward slashes as path separators, Vim will pass
them as backslashes to the shell.


Best regards,
Tony.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment