如何使用Cygwin在将当前目录从批处理传递到bash时执行bash脚本

我需要在Cygwin的帮助下运行cmd-recursive.sh脚本。有.bat会将当前脚本的路径设置为变量。

此命令在Cygwin终端下运行时更改目录就很好了。

cd "$(echo "D:\real\Path with Spaces\TargetFolder" | sed "s/^D:/\/cygdrive\/d/;s/\\\/\//g;")"

executor.bat

@echo off
set mypath=%cd%
C:\cygwin64\bin\bash -l "cd ""$(echo %mypath% | sed "s/^D:/\/cygdrive\/d/;s/\\\/\//g;")"""; ./cmd-recursive.sh"

执行结果:

/usr/bin/bash: cd "$(echo D:\real\Path with Spaces\TargetFolder | sed s/D://cygdrive/d/;s/\///g;)";: No such file or directory
zhan923518648 回答:如何使用Cygwin在将当前目录从批处理传递到bash时执行bash脚本

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2960736.html

大家都在问