【发布时间】:2021-05-10 00:47:42
【问题描述】:
非常简单的设置,请在家尝试一下。
test.ps1
$args
test.rb(如有必要,替换为所选语言)
p ARGV
test.bat
@echo off
ruby test.rb "foo bar moo"
powershell .\test.ps1 "foo bar moo"
pause
运行 test.bat。猜猜输出。
如果你和我一样想,那你就错了。
输出
["foo bar moo"]
foo
bar
moo
Ruby 是我的见证,这三个词作为单个参数传递。以比尔·盖茨的名义,PowerShell 在做什么?我怎样才能使它合乎逻辑地工作?
或者我错过了什么?
【问题讨论】:
-
好的,我至少找到了解决方法:
powershell .\test.ps1 """foo bar moo"""。所以它需要转义引号?但为什么呢?
标签: powershell