Opening remote file with scp and netrw on Windows 7

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Opening remote file with scp and netrw on Windows 7

Oliver Graute
Hello list,

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

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

meine van essen
On Tue, Aug 28, 2018 at 09:22:04PM +0200, Oliver Graute wrote:

> Hello list,
>
> 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?

I guess this has nothing to do with vim, but is in the way Windows
translates and interprets your scp command.

when using (g)vim in Windows, just use the proper command for that
environment ('pscp' ?), so it doesn't need to be translated.

the "oot" error output indeed is somewhat strange...

//meine

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Gua Chung Lim-2
In reply to this post by Oliver Graute
* Oliver Graute ([hidden email]) wrote:

> :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 also experienced this problem before on Windows, but it works pretty fine on my BSD, mac or Linux box. When I tried it on Windows with the isolated Vim, it failed. I then switched and tried it again under Cygwin on Windows, this time it worked fine. I believe that without installing wget, curl or something similar on the system or environment, you will not be able to open any remote files with Vim. So IMHO, the problem you are encountering is not Vim itself, but the environment you are using.

--
Gua Chung Lim
 
"UNIX is basically a simple operating system,
but you have to be a genius to understand the simplicity."
-- Dennis M. Ritchie

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

lessthanideal
In reply to this post by Oliver Graute
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Oliver Graute
On 03/09/18, lessthanideal wrote:

> 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

ok this is fixing this error:

> > The command "oot" is either misspelled or could not be found.
> > shell returned 1

now he asks at least for the password but is complaing about unexpected
end-of-file

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\VIA9103.log"
root@192.168.1.229's password:
Fatal: Received unexpected end-of-file from server
shell returned 1
Hit any key to close this window...

Best regards,

Oliver

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Oliver Graute
On 07/09/18, Oliver Graute wrote:

> On 03/09/18, lessthanideal wrote:
> > 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
>
> ok this is fixing this error:
>
> > > The command "oot" is either misspelled or could not be found.
> > > shell returned 1
>
> now he asks at least for the password but is complaing about unexpected
> end-of-file
>
> 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\VIA9103.log"
> root@192.168.1.229's password:
> Fatal: Received unexpected end-of-file from server
> shell returned 1
> Hit any key to close this window...

finally fixed this issue by adding -scp flag to the pscp command.
for whatever reason I must tell pscp to use scp :-p

now this is in my vimrc

if has ("win32") || has("win64")
        set shellxquote=\"
        set shellcmdflag=/s\ /c
        let g:netrw_scp_cmd  = "pscp -scp"
endif

thx for your hints,

Oliver

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.