将.sh转换为.bat



我有一个我想转换为 .bat文件的 .sh文件。在下面,您可以看到我的Shell脚本,在下面是我将Shell脚本转换为批处理文件的SAD尝试。我能够掩盖某些部分,但其他部分"陷入困境",例如试图将node pong.js $1命令的输出呼应到__pongjs_output.txt

# Run a .php file both on pong.js and php and diff the output.
# Run on pong.js
node pong.js $1 > __pongjs_output.txt
# Run on node and replace some property names.
php $1 > __php_output.txt
echo "$1:"
diff __pongjs_output.txt __php_output.txt && echo "ok"
rm __pongjs_output.txt __php_output.txt

我尝试将shell文件转换为批处理文件的尝试:

@ECHO off
REM Run a .php file both on pong.js and php and diff the output.
REM Run on pong.js
ECHO node pong.js %1 > __pongjs_output.txt
REM Run on node and replace some property names.
ECHO php %1 > __php_output.txt
ECHO %1:
FC __pongjs_output.txt __php_output.txt
IF errorlevel 0 ECHO ok
DEL __pongjs_output.txt __php_output.txt

尝试一下(从节点和php之前删除回声):

@ECHO off
REM Run a .php file both on php.js and php and diff the output.
REM Run on pong.js
node pong.js %1 > __pongjs_output.txt
REM Run on node and replace some property names.
php %1 > __php_output.txt
ECHO %1:
FC __pongjs_output.txt __php_output.txt
IF errorlevel 0 ECHO ok
DEL __pongjs_output.txt __php_output.txt

最新更新