无法识别 Windows 脚本命令
我正在尝试运行 cmd 文件,但收到奇怪的错误。我正在运行这个:
#!/bin/ksh
#@echo off
#REM *************************************************************************
...
...
但结果返回时出现错误,如下所示:
C:>#!/bin/ksh
'#!' is not recognized as an internal or external command,
operable program or batch file.
C:>#@echo off
'#@echo' is not recognized as an internal or external command,
operable program or batch file.
C:>#REM *************************************************************************
'#REM' is not recognized as an internal or external command,
operable program or batch file.
我在两台计算机上尝试过此操作,结果相同。谁能告诉我为什么会发生这种情况?
I am trying to run a cmd file but I am receiving strange errors. I am running this:
#!/bin/ksh
#@echo off
#REM *************************************************************************
...
...
But the results are returned with errors like so:
C:>#!/bin/ksh
'#!' is not recognized as an internal or external command,
operable program or batch file.
C:>#@echo off
'#@echo' is not recognized as an internal or external command,
operable program or batch file.
C:>#REM *************************************************************************
'#REM' is not recognized as an internal or external command,
operable program or batch file.
I have tried this on two computers with the same results. Can any one tell me why this is happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个
ksh
脚本,通过ksh
(或任何 shell,如bash
、sh
、启动它) csh
或tcsh
可以理解#!
行)而不是 Windows 命令行。您可能需要安装 cygwin(使用 ksh),启动 cygwin 终端并从那里启动脚本。This is a
ksh
script, launch it thoughksh
(or any shell likebash
,sh
,csh
ortcsh
which understand the#!
line) and not the windows command line. You may need to installcygwin
(withksh
), start a cygwin terminal and launch your script from there.