从 Windows 命令行运行 cygwin 命令

Tim*_*mur 6 cygwin rsync command-line

我试图让 PhpStormvagrant rsync在文件更改时运行,因为内置rsync-auto在我的深层目录结构中失败。我可以在 PhpStorm 设置中设置观察程序,但我不知道如何正确运行它。问题是,当我运行vagrant upvagrant rsync从 Windows 命令行运行时,我收到了从错误路径到参数问题的不同错误,因此我决定在 cygwin 下运行它,它现在可以工作了。所以,我需要一个解决方案来从命令行运行 cygwin 并在其中执行命令。

我尝试过的:

C:/cygwin/bin/bash vagrant rsync
Run Code Online (Sandbox Code Playgroud)

出现错误:

C:\Program Files\Vagrant\embedded\bin\ruby.exe: No such file or directory -- /cygdrive/c/Program Files/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/lib/vagrant/pre-rubygems.rb (LoadError)
Run Code Online (Sandbox Code Playgroud)

尝试过:

bash vagrant rsync
Run Code Online (Sandbox Code Playgroud)

错误:

rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receive
r=3.0.9]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [sender=
3.1.1pre1]
Run Code Online (Sandbox Code Playgroud)

试图找出输出不同的原因:

C:\>where bash
C:\Program Files\Git\bin\bash.exe
Run Code Online (Sandbox Code Playgroud)

所以msysgit用于第二种情况。

命令:

C:\cygwin\bin\mintty -e vagrant sync
Run Code Online (Sandbox Code Playgroud)

输出:什么也没有。窗口立即打开和关闭。

小智 8

使用 c:\cygwin\bin\run.exe 从 Windows cmd.exe 启动 cygwin 进程

  • 效果很好,但不显示输出。要显示输出,请使用 ```C:\\cygwin64\\bin\\bash --login -c '/usr/bin/rsync'``` (2认同)

Hyp*_*ive 7

使用bash带有--login&-c选项的命令从 Windows 启动 Cygwin 进程并查看输出。

IE。C:\\cygwin64\\bin\\bash --login -c 'whoami'