如何从 32 位 cmd.exe 启动 64 位 powershell? [英] How to launch 64-bit powershell from 32-bit cmd.exe?

查看:24
本文介绍了如何从 32 位 cmd.exe 启动 64 位 powershell?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是一个奇怪的问题,但我被锁定在第三方供应商中,该供应商在目标 64 位 Windows Server 2008 R2 群集服务器上启动 32 位 cmd.exe.从这里我想启动一个 64 位 PowerShell 窗口并运行一个脚本.

I know it's a weird question but I am locked into a third party vendor which launches a 32-bit cmd.exe on a target 64-bit Windows Server 2008 R2 clustered server. From here I want to launch a 64-bit PowerShell window and run a script.

这是我的测试:

powershell.exe "Get-Module -ListAvailable| Where-Object {$_.name -eq 'FailoverClusters'}"

如果我从 32 位 cmd.exe 运行它,我什么也得不到.如果我从 64 位 cmd.exe 运行,我会得到:

If I run this from a 32-bit cmd.exe I get nothing returned. If I run from a 64-bit cmd.exe I get:

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   FailoverClusters          {}

关于如何从 32 位 cmd shell 调用 64 位 powershell 脚本的任何想法?

Any ideas on what I can do to invoke a 64-bit powershell script from a 32-bit cmd shell?

推荐答案

syswow64 允许您从 64 位代码运行 32 位系统可执行文件.sysnative 可让您从 32 位代码运行 64 位系统可执行文件.

syswow64 lets you run 32 bit system executables from 64 bit code. sysnative lets you run 64 bit system executables from 32 bit code.

所以,你需要运行:

%SystemRoot%sysnativeWindowsPowerShellv1.0powershell.exe

这篇关于如何从 32 位 cmd.exe 启动 64 位 powershell?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆