启动相关程序或显示“打开方式”另一个程序的对话框 [英] Launch associated program or show "Open with" dialog from another program

查看:232
本文介绍了启动相关程序或显示“打开方式”另一个程序的对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Window Seven下,以下命令显示一个对话框,然后在没有任何其他操作的情况下终止,为什么?

Under Window Seven, the following command displays a dialog box then terminates without any other action, why?

预期效果是启动相关程序 Notepad ++ 或至少记事本

The expected effect is launching the associated program Notepad++ or at least Notepad

RUNDLL32.EXE SHELL32.DLL,OpenAs_RunDLL D:\doc\toto.txt

推荐答案

解决方案非常简单: cmde.exe start

这是嵌入命令的Java代码:

Here is the Java code which embed the command:

private void open( File file ) {
   try {
      final String cmd =
         String.format( "cmd.exe /C start %s", file.getAbsolutePath());
      Runtime.getRuntime().exec( cmd );
   }
   catch( final Throwable t ) {
      t.printStackTrace();
   }
}

.project ,显示以下对话框:

当选择底部的单选按钮时,将显示以下对话框:

and when the radio button at the bottom is chosen the following dialog is shown:

这是正是我想要的。

这篇关于启动相关程序或显示“打开方式”另一个程序的对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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