修改shell脚本以在Windows中执行它

时间:2019-03-01 13:45:06

标签: windows bash shell

我需要将此脚本适应我的环境:

for entry in `ls *.tcl`
do
    if [ -f "$entry" ];then
        echo "$entry" 
        echo test.bat -w test_workspace -file ./$entry
        test.bat -w test_workspace -file ./$entry
    fi;     
done

我将此脚本放在了test.bat的相同位置 但是我有这个错误:

test.bat -w test_workspace -file ./script1.tcl
bash: test.bat: command not found

1 个答案:

答案 0 :(得分:0)

您可以调用 cmd 命令来执行bat文件,如下所示:

for entry in `ls *.tcl`
do
    if [ -f "$entry" ];then
        echo "$entry" 
        echo test.bat -w test_workspace -file ./$entry
        cmd /c test.bat -w test_workspace -file ./$entry
    fi;     
done