javawindowsrundll32shell32.dll

Launch associated program or show "Open with" dialog from another program


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

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

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

enter image description here


Solution

  • The solution is very simple: cmde.exe start

    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();
       }
    }
    

    When .project is selected the following dialog is shown:

    enter image description here

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

    enter image description here

    That's exactly what I want.