batch-file - 具有从 cmd 调用的输入重定向的批处理脚本自动添加数字参数
问题描述
我有一个名为 runcmd.bat 的 cmd 批处理脚本,如下所示
plink.exe -ssh 1.11.1.1 -l kaka -pw babay < commands.txt >output.txt
从 CMD 调用此批处理脚本时,会生成以下错误:
C:\Users\ASAD\Desktop\PuTTY>runCmd.bat
C:\Users\ASAD\Desktop\PuTTY>c:
C:\Users\ASAD\Desktop\PuTTY>cd \
C:\>cd "Users\ASAD\Desktop\PuTTY"
C:\Users\ASAD\Desktop\PuTTY>plink.exe -ssh 1.11.1.1 -l kaka -pw babay 0<commands.txt 1>>output.txt
The system cannot find the file specified.
C:\Users\ASAD\Desktop\PuTTY>
The system cannot find the file specified.
如果您可以看到,它会在 < 和 > 输入和输出重定向运算符之前自动添加 0 和 1。
我正在使用 Windows 8.1 x64。我也在 windows 2012 R2 Server 中尝试过同样的方法,但最终都显示相同。
我希望脚本在输入和输出重定向器之前执行而不添加任何数字。
解决方案
推荐阅读
- php - 外部文件的新模板 - VueJS
- python-3.x - Python中的排名/计数
- mysql - MySQL INSERT INTO 语句出现问题,DATETIME 值不会转移到新表
- c++ - 为什么尝试在 C++ 中分配二维数组会导致内存损坏错误?
- excel - Excel:SUMIF 的 SUM 与 VLOOKUP 的 SUM 与数组函数?
- c# - 错误 CS1061 不包含定义 - Roslyn 编译问题
- datatables - I18n 翻译未在 Datatable 初始化中呈现?
- java - 在哪里放置 -Xms java 选项
- mysql - mysql 数据库中的死锁(Percona Server for mysql 5.7.22-22-1.trusty)
- python - 在熊猫中,如何将具有许多属性和值的列解析为新列并获取它们的值