pay*_*ing 3 powershell windows-xp-mode powershell-2.0
这是我从 Windows 7 启动的应用程序的快捷方式目标,该应用程序在 Windows XP 模式下启动程序。
%SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\VMCPropertyHandler.dll,LaunchVMSal "Windows XP Mode" "||fc9407e9" "wIntegrate"
Run Code Online (Sandbox Code Playgroud)
我似乎无法让 PS Start-process 命令为该目标工作。
我使用的代码:
Start-Process %SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\VMCPropertyHandler.dll,LaunchVMSal "Windows XP Mode" "||fc9407e9" "wIntegrate"
Run Code Online (Sandbox Code Playgroud)
这是我收到的错误:
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
Run Code Online (Sandbox Code Playgroud)
有没有人有幸从 Windows 7 的 Powershell 执行 Windows XP Mode 应用程序?
这应该为你做:
$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;
Run Code Online (Sandbox Code Playgroud)
第一个技巧:%systemroot% 在 PS 中不起作用,因此我们分配一个变量 ($sysRoot) 以在 PS 中获取该环境变量。
下一个技巧是意识到只有一个参数提供给 RunDLL32,并且该参数有参数。因此,我们需要使用引号将参数的所有部分都包含在一个参数中。但是我们需要在该参数中保留现有的引号,因此我们使用`.
希望有帮助...
| 归档时间: |
|
| 查看次数: |
2448 次 |
| 最近记录: |