Start Win Explorer with folder

hello all,

how can I start Win explorer with explorer?

I read this: Parameter des Windows Explorers "explorer.exe" - Windows FAQ

but this doesn’t work

    launch ( "explorer.exe"+
      " /n," +
      sketchPath("")+""+pathFolder+"\\"   );

OR

try
    {
      ProcessBuilder pb = new ProcessBuilder("explorer", " ", "/n,", sketchPath("")+""+pathFolder+"\\");
      Process p = pb.start();
    }
    catch ( Exception e )   // IOException, URISyntaxException
    {
      e.printStackTrace();
    }//catch

Hello @chrisir,

Reference:
https://ss64.com/nt/explorer.html

Example:

This will open sketch folder:

launch ("explorer.exe" + 
        ' ' +
        '"' +
        sketchPath("") +
        '"');

:)

2 Likes

That worked! Thanks a lot!

These all work as well:

// https://processing.org/reference/String.html
// https://processing.org/reference/launch_.html
// https://ss64.com/nt/explorer.html

//**********************************************  

launch ("explorer.exe" + 
        "/n," +              //No spaces!
        sketchPath(""));
 
//**********************************************        
        
String s = "explorer.exe" + 
        "/n," +              //No spaces!
        sketchPath("");
        
println(s);        
launch(s);

//********************************************** 

String sp = sketchPath("");
String args [] = {"explorer.exe", "/n,", sp};
launch(args);

:)

1 Like

Thank you!

This is the code to launch Notepad under Win 10

  case '2':
    String s = "notepad.exe" +
      " " +              //
      dataPath("")
      +"\\"
      + "keywords.tsv"; //

    println(s);
    launch(s);

    break;

and Firefox

case '1':
    String [] a1 = new String [2];
    a1[0]= "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
    a1[1]= "www.youtube.com" ;
    launch(a1); //  launch:www.youtube.com
    break;