0
我想从命令行向Power Shell传递数组%variable%,然后使用此数组变量在Power shell中执行操作,但我有将变量正确传递给电源外壳时遇到麻烦。当前.BAT脚本调用电源外壳脚本如下...Pass String String从命令行(.BAT文件)变为Power Shell脚本
SET STRING_ARRAY="test1" "test2" "test3" "test4"
Powershell.exe -executionpolicy remotesigned -File "FILEPATH\Build_DB.ps1" %STRING_ARRAY%
然后下面电源外壳脚本,以测试阵列varaible的SUCESSFUL切换如下:
[email protected]($args[0])
Write-Host $string_array.length
for ($i=0; $i -lt $string_array.length; $i++) {
Write-Host $string_array[$i]
}
然而一切返回距离电源壳长度为1。我在这里做错了什么?