Monday, September 3, 2018

Re: Opening remote file with scp and netrw on Windows 7

On Tuesday, 28 August 2018 20:22:15 UTC+1, Oliver Graute wrote:
> I tried to open a remote file in Vim with this command:
>
> :e scp://root@192.168.1.229:2222//home/root/output.log
>
> on Linux this is working fine. But on Windows 7 just a command line
> window is opening with this Error message:
>
> C:\Windows\system32\cmd.exe -c "pscp -q -P 2222 "root@192.168.1.229:/home/root/output.log" "C:\Users\OGR\AppData\Local\Temp\VIA3B61.log""
>
> The command "oot" is either misspelled or could not be found.
> shell returned 1
>
> Hit any key to close this window...
>
> I'am using vim 8.0 with netrw v156
> Some hints howto fix this?
>
> Best regards,
>
> Oliver

The similar :e command works for me. I think the key difference may be my generated Windows command string includes the "/s" parameter which modifies how strings after "/c" are treated. (Run cmd /? to see details.) So your example modified to what I see looks like

C:\Windows\system32\cmd.exe /s /c ""c:\program files (x86)\Putty\pscp.exe" -pw MyPassword -q -P 2222 "root@192.168.1.229:/home/root/output.log" "C:\Users\OGR\AppData\Local\Temp\VIA3B61.log""

I have this in my _vimrc which I suppose is responsible

"Fix passing quoted commands to cmd.exe
"http://groups.google.com/group/vim_dev/browse_thread/thread/3d1cc6cb0c0d27b3
if has ("win32") || has("win16")
set shellxquote=\"
set shellcmdflag=/s\ /c
endif


I'm using quite an old version of netrw ( g:loaded_netrwPlugin = v142), and running Windows 7 Professional Service Pack 1 64bit

VIM version:
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 4 2018 23:02:16)
MS-Windows 64-bit GUI version with OLE support
Included patches: 1-1473

For me "set shell?" shows

shell=C:\Windows\system32\cmd.exe

-------------

BTW I also explicitly set the SCP command to use, not sure if that affects things.

let g:netrw_scp_cmd='"c:\Program Files (x86)\PuTTY\pscp.exe" -pw ' . a:password_string . ' -q'

I also set a:password_string, of course.

regards,
Geoff

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment