windows - 从 powershell 在批处理文件中传递参数

标签 windows batch-file

我在 Windows 中制作了一个批处理文件。那个文件里面的内容是这样的

测试.bat

echo %1

现在当我像这样从命令行发送参数时

test.bat "hello"

然后它总是输出 %1。它应该是 hello

我做错了什么?

最佳答案

也许您正在使用 power-shell。你需要在你的 bat 文件中使用以下内容:

echo $1

这里是将 DOS 批处理文件转换为 Shell 脚本

 http://tldp.org/LDP/abs/html/dosbatch.html

关于windows - 从 powershell 在批处理文件中传递参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25636694/

相关文章:

windows - 将多个命令传递给批处理文件中的 START 命令

batch-file - 如何使用批处理来确定计算机是使用 FAT32 还是 NTFS?

c++ - 如何检索 netstat 命令的结果

windows - 在 Windows XP 中将 Selenium Server standalone 2 作为服务运行

windows - Windows 应用商店应用程序与 native 桌面应用程序之间的通信

batch-file - 如何将所有 mp3 文件移动到一个目录中?

c++ - OpenGL 闪烁/损坏,窗口调整大小和 DWM 处于事件状态

Windows .bat 文件不执行其序列

batch-file - 为什么 forfiles 吞下命令的第一个参数?

windows - 如何允许用户选择要复制的目录?