Kru*_*lur 6 shell-script stdin cmd.exe
在 Bash 中,我可以做这样的事情
somecmd << END
a lot of
text here
END
Run Code Online (Sandbox Code Playgroud)
直接从脚本向命令提供输入。我需要在 CMD.exe 批处理文件(.cmd 脚本)中做同样的事情。是否可以?
我相信您可以为每一行使用一个^
字符。
例如:
echo This is a really long ^
text message that spans multiple ^
lines
Run Code Online (Sandbox Code Playgroud)
返回:
C:\Users\Jonno>echo This is a really long ^
More? text message that spans multiple ^
More? lines
This is a really long text message that spans multiple lines
Run Code Online (Sandbox Code Playgroud)
它很简单,但不像在 Unix/Linux 中那样干净。尝试这个:
(@echo.a lot of
@echo.text here
) | somecmd
Run Code Online (Sandbox Code Playgroud)
请注意,.
echo 语句之后允许您以空格开始一行。@
需要该符号以防止将 echo 语句发送到somecmd
. 您可以@
这样消除符号:
echo off
(echo.a lot of
echo.text here
) | somecmd
echo on
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8799 次 |
最近记录: |