简体   繁体   English

powershell命令的多个参数

[英]Multiple arguments for powershell command

I'm having an issue with passing arguments to an executable through powershell. 我在通过Powershell将参数传递给可执行文件时遇到问题。

The command that I pass is: .\\migrator.exe migrate -d12345,12333,12222 -i09877,787896,76866 我传递的命令是:。\\ migrator.exe migration -d12345,12333,12222 -i09877,787896,76866

Here's where I am having an issue. 这是我遇到的问题。 The command works perfectly in CMD shell, but in powershell, it fails on the commas and will not execute the command. 该命令在CMD Shell中可以完美运行,但是在Powershell中,它在逗号上失败并且将不执行命令。 Do I need to be passing this into an array object or wrapping it with quotes or what? 我需要将其传递到数组对象中还是用引号将其包装起来?

如果您使用的是PowerShell v3或更高版本,则可以使PowerShell像使用CMD一样使用--%运算符将参数传递给migration.exe,例如:

.\migrator.exe migrate --% -d12345,12333,12222 -i09877,787896,76866

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PowerShell命令多行 - PowerShell command over multiple lines PowerShell:将命令应用于多个文件 - PowerShell: apply command to multiple files 使用多个参数执行多个命令行 - Execute multiple command lines with multiple arguments 替换PowerShell文件中的字符串,然后通过批处理+命令行参数调用它 - Replacing strings in a PowerShell file and then calling it via batch + command line arguments 使用Powershell的Invoke-Command调用带参数的批处理文件 - Using Powershell's Invoke-Command to call a batch file with arguments 如何将命令行 arguments 传递给由 doskey 调用的 PowerShell 脚本 - How to pass command line arguments to a PowerShell script invoked by a doskey 批处理:从命令参数中获取多个FOR参数 - batch: multiple FOR parameter taken from command arguments 如何将多个命令参数发送到批处理文件 - How to send to batch file multiple arguments of command PowerShell - 如何对特定文件执行 BAT(批处理)命令? (连接路径和命令并传播 arguments ) - PowerShell - How to execute BAT (batch) command on specific file? (Concatenate path and command and propagate arguments ) 创建批处理文件以多次运行带参数的命令 - Create a batch file to run a command with arguments multiple times
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM