Windows 7에서 Powershell을 사용하여 Windows XP Virtual PC 응용 프로그램을 시작하는 방법은 무엇입니까?

Windows 7에서 Powershell을 사용하여 Windows XP Virtual PC 응용 프로그램을 시작하는 방법은 무엇입니까?

이것은 Windows XP 모드에서 프로그램을 시작하는 Windows 7에서 실행하는 응용 프로그램의 바로 가기 대상입니다.

%SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\VMCPropertyHandler.dll,LaunchVMSal "Windows XP Mode" "||fc9407e9" "wIntegrate"

PS Start-process 명령이 해당 대상에 대해 작동하지 않는 것 같습니다.

내가 사용하는 코드:

Start-Process %SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\VMCPropertyHandler.dll,LaunchVMSal "Windows XP Mode" "||fc9407e9" "wIntegrate"

내가 받은 오류는 다음과 같습니다.

Start-Process : A positional parameter cannot be found that accepts argument 'Windows XP Mode'.
At C:\Users\username.domain\Desktop\rebootpick.ps1:13 char:14
+ Start-Process <<<<  %SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\VMCPropertyHandler.dll,LaunchVMSal "Windows XP Mode" "||fc9407e9" "wIntegrate"
    + CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand

Windows 7의 Powershell에서 Windows XP 모드 응용 프로그램을 실행한 사람이 있나요?

답변1

이렇게 하면 됩니다.

$sysRoot = get-content env:systemroot;
Start-Process $sysRoot\system32\rundll32.exe -ArgumentList "$sysRoot\system32\VMCPropertyHandler.dll,LaunchVMSal `"Windows XP Mode`" `"||fc9407e9`" `"wIntegrate`"";
Remove-Variable sysRoot;

첫 번째 트릭: %systemroot%는 PS에서 작동하지 않으므로 PS에서 해당 환경 변수를 가져오기 위해 변수($sysRoot)를 할당합니다.

다음 비결은 RunDLL32에 단 하나의 인수만 제공되고 해당 인수에는 인수가 있다는 것을 인식하는 것입니다. 따라서 인수의 모든 부분을 따옴표를 사용하여 하나의 인수로 묶어야 합니다. 하지만 해당 인수에 기존 따옴표를 유지해야 하므로 `.

도움이 되길 바랍니다...

관련 정보