32 位 cmd.exe 如何在 Windows Server 2003 x64 上启动 64 位 cmd.exe?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8453277/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:37:33  来源:igfitidea点击:

How can a 32-bit cmd.exe launch a 64-bit cmd.exe on Windows Server 2003 x64?

windowscmd32bit-64bit

提问by Minus Ex

This is a follow up to 7-Zip execution permissions on Windows Server 2008 64-bit.

这是对 Windows Server 2008 64 位 7-Zip 执行权限的跟进。

I'm trying to avoid having an overly complicated build process to make multiple 7-Zip EXE files. I just need a .cmd to kick off my Java process after reading some 64-bit registry entries. However, to succeed with a single EXE file, it needs to be 32 bit.

我试图避免使用过于复杂的构建过程来制作多个 7-Zip EXE 文件。在阅读了一些 64 位注册表项后,我只需要一个 .cmd 来启动我的 Java 进程。但是,要成功使用单个 EXE 文件,它需要是 32 位的。

The above question found a trick for getting Windows Server 2008 to detect a 32 bit cmd.exe and swap it to 64 bit. Is there a way to do this on Windows Server 2003? There's a Windows hotfix that allows reg.exe to access 64-bit entries in 32-bit mode, but I can't be assured that's on the customer's server so that workaround is a no go.

上述问题找到了让 Windows Server 2008 检测 32 位 cmd.exe 并将其交换为 64 位的技巧。有没有办法在 Windows Server 2003 上做到这一点?有一个 Windows 修补程序允许 reg.exe 在 32 位模式下访问 64 位条目,但我不能确定它在客户的服务器上,因此解决方法是行不通的。

回答by MBu

To launch 64-bit cmd.exe from 32-bit cmd.exe you must be able to access c:\Windows\System32folder without being redirected to c:\Windows\SysWow64folder. In Win2008 you can achieve this by accessing c:\Windows\Sysnativepath. Unfortunately on Win2003 a hotfix is required (see http://support.microsoft.com/kb/942589).

要从 32 位 cmd.exe 启动 64 位 cmd.exe,您必须能够访问c:\Windows\System32文件夹而不会被重定向到c:\Windows\SysWow64文件夹。在 Win2008 中,您可以通过访问c:\Windows\Sysnative路径来实现这一点。不幸的是,在 Win2003 上需要一个修补程序(请参阅http://support.microsoft.com/kb/942589)。

There is a workaround - you can create an NTFS junction point that directs to c:\Windows\System32folder and use path to that junction point instead of c:\Windows\System32. Using System Internals' junction.exeI managed to create such a junction point from 32-bit cmd.exe and launch 64-bit cmd.exe.

有一个解决方法 - 您可以创建一个指向c:\Windows\System32文件夹的 NTFS 连接点,并使用该连接点的路径而不是c:\Windows\System32. 使用 System Internals 的junction.exe,我设法从 32 位 cmd.exe 创建了这样一个连接点并启动了 64 位 cmd.exe。