如何从32位进程启动一个64位进程 [英] How to start a 64-bit process from a 32-bit process

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

问题描述

我试图运行从我们的32位.NET应用程序在64位可执行文件(java.exe的)。我使用进程类,并调用 CMD /℃下命令名称> ,以支持所有可能的命​​令(如 DIR 光盘等)。

I am trying to run a 64 bit executable (java.exe) from our 32-bit .NET application. I am using Process class and invoking cmd /c <command name> in order to support all possible commands (like dir, cd etc).

现在的问题是,我的机器上我安装64位版本的JRE和java.exe的是只能从 C:\ Windows \ System32下文件夹中(64位)。我曾尝试explicily启动64位版本的 CMD.EXE 致电 C:\ WINDOWS \ SYSTEM32 \ CMD.EXE 但它被重定向到 Syswow64资料由于调用进程是32位。

The problem is that on my machine I installed 64-bit version of JRE and java.exe is only available from C:\Windows\System32 folder (x64). I have tried explicily starting 64 bit version of cmd.exe by calling C:\Windows\System32\cmd.exe but it gets redirected to SysWOW64 due to calling process being 32 bit.

还有什么我可以做的就是这个工作?

Is there anything else I can do to get this to work?

修改 CMD / C 的事情是有点红鲱鱼。这不是问题的一部分,能够运行64位可执行文件的。

EDIT The whole cmd /c thing is a bit of a red herring. It is not part of the problem, being able to run 64 bit executables is.

推荐答案

您可以暂时禁用各地调用的Process.Start文件系统重定向,相应的API为P / Invoke的是<一href="http://pinvoke.net/default.aspx/kernel32/Wow64DisableWow64FsRedirection.html">Wow64DisableWow64FsRedirection和<一href="http://pinvoke.net/default.aspx/kernel32/Wow64RevertWow64FsRedirection.html">Wow64RevertWow64FsRedirection.

You can temporarily disable filesystem redirection around the call to Process.Start, the appropriate API's to P/Invoke are Wow64DisableWow64FsRedirection and Wow64RevertWow64FsRedirection.

另一种选择是使用%WINDIR%\ sysnative,它可以在Windows Vista和上面。

Another option is to use %windir%\sysnative, which is available on Windows Vista and above.

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

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