这是我的
test.bat
#!/bin/bash
#set the STRING variable
SET STRING=Hello World
#Print the contents of the variable to the screen
echo $STRING
pause
当我在Windows10上运行test.bat时,会得到以下输出:
C:\Workspace\mcc-batch-jobs>#!/bin/bash
'#!' is not recognized as an internal or external command,
operable program or batch file.
C:\Workspace\mcc-batch-jobs>#set the STRING variable
'#set' is not recognized as an internal or external command,
operable program or batch file.
C:\Workspace\mcc-batch-jobs>SET STRING=Hello World
C:\Workspace\mcc-batch-jobs>#Print the contents of the variable to the screen
'#Print' is not recognized as an internal or external command,
operable program or batch file.
C:\Workspace\mcc-batch-jobs>echo $STRING
$STRING
C:\Workspace\mcc-batch-jobs>pause
Press any key to continue . . .
我想不出来。我检查了我的路径,安装了cygwin,查看了几个stackoverflow帖子,似乎无法让脚本工作。脚本是作为一个简单的测试而创建的。