Wednesday, May 30, 2012

Re: Call external command with relative path

Christian Brabandt wrote:
> On Wed, May 30, 2012 16:19, oversky wrote:
>
>> I still have problem.
>> I check with :echo $PORTABLE,
>> it shows correct path.
>> But the error message still says it can't find the file.
>> Then I use :! instead of :%!,
>> the command paste to shell is
>>
>> C:\WINDOWS\system32\cmd.exe /c $PORTABLE\ConvertZ\ConvertZ.exe /
>> i:sjis /o:utf8 1.cue
>>
>> $PORTABLE is not replaced by its value.
>> Any suggestion?
>>
> :h expand()
>
I think you'll need to know about

:he exe

ie.
:let PORTABLE = fnamemodify($VIMRUNTIME, ':h:h:h:h')
:exe '%!C:\WINDOWS\system32\cmd.exe /c
'.PORTABLE.'\ConvertZ\ConvertZ.exe /'

or, if you prefer,
:exe '%!C:\WINDOWS\system32\cmd.exe /c
'.fnamemodify($VIMRUNTIME, ':h:h:h:h').'\ConvertZ\ConvertZ.exe /'

Now for the caveats: I'm not using Windows, don't have ConvertZ.exe, am
not using a thumb drive, so the above has not been tested.

Regards,
Chip Campbell

--
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