cmd.exe로 호출 할 때 PowerShell에서 HashTable을 인수로 전달하는 방법이 있습니까?cmd.exe powershell HashTable
나는이 같은 스크립트를 호출 할 :
powershell "& 'C:\path\to\file.ps1 arg1 arg2 arg3 arg4'"
arg4는 해시 테이블입니다. 이것이 가능한가?
cmd.exe로 호출 할 때 PowerShell에서 HashTable을 인수로 전달하는 방법이 있습니까?cmd.exe powershell HashTable
나는이 같은 스크립트를 호출 할 :
powershell "& 'C:\path\to\file.ps1 arg1 arg2 arg3 arg4'"
arg4는 해시 테이블입니다. 이것이 가능한가?
:
param($a1, $a2, $a3, [hashtable]$a4)
"a1 is $a1"
"a2 is $a2"
"a3 is $a3"
"a4 is "
$a4
당신은 너무 네 번째 매개 변수로 해시 테이블을 지정처럼 cmd.exe를에서 호출 할 수 있습니다 :
C:\> powershell -command "& {c:\foo.ps1 1 2 three @{name='John';age=45}}"
a1 is 1
a2 is 2
a3 is three
a4 is
Name Value
---- -----
name John
age 45
해시 테이블을 xml로 저장하고 파일 이름을 전달하는 것만 듭니다. 이 같은 스크립트 (foo.ps1)을 감안할 때