0

我正在使用 MSG 命令[NETSEND 不再可用] 将消息从 Win 7/2008 服务器(32/64 位)发送到 Win 7/2008 服务器(32/64 位),而我的 Java 应用程序是 32 位,不能使用 64由于某些要求(使用 java 7 update 25)。当我在下面运行我的 java 应用程序时是这样的场景

  1. 32 位 Win 7/2008 服务器到 32 位 Win 7/2008 - 工作
  2. 32 位 Win 7/2008 服务器到 64 位 Win 7/2008 - 工作
  3. 32 位 Win 7/2008 服务器到 64 位 Win 7/2008 - 工作

    4. 64 位 Win 7/2008 服务器到 64 位 Win 7/2008 - 不工作

    5. 64 位 Win 7/2008 服务器到 32 位 Win 7/2008 - 不工作

是否有任何解决方法可以使这项工作在 64 位 Win 7/2008 服务器上工作?

package msgcommand;

import java.io.*;  
public class TestExec {  
    public static void main(String[] args) {  
        try {  
            Process p = Runtime.getRuntime().exec("cmd /C MSG.exe /SERVER:127.0.0.1 * test");  
            BufferedReader in = new BufferedReader(  
                                new InputStreamReader(p.getInputStream()));  
            String line = null;  
            while ((line = in.readLine()) != null) {  
                System.out.println(line);  
            }  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
    }  
}
4

1 回答 1

0

问题的原因是,在 64 位系统上,32 位应用程序无法访问 windows\system32 文件夹。你会重新

要达到 32 位版本 auf msg.exe,您可以使用特殊文件夹%WinDir%\Sysnative来执行 msg.exe

详细信息可在此处获得:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa384187%28v=vs.85%29.aspx http://support.microsoft.com/kb/942589/en-us

于 2014-05-08T05:35:23.307 回答