Browse file folder tool

Browse file folder tool

63
Advanced UserAdvanced User
63

    Aug 08, 2004#1

    This is a post from the old Forum but I thought it was so good I wanted everyone see it.
    Special thanks to "dmancine" for the orginal post!

    "This is a tip, not a question.

    I have a "tool" configured that I use all the time that some members of the UE community might find useful (pardon me if it's totally obvious and everyone already knows about it).

    It opens the Windows file browser for the directory where the active file lives (hence the Save Active File requirement). I use it all the time, especially when I'm working on a large Java project with lots of deeply-nested packages. I probably use it 50 times a day at least. It probably saves me about 55 hours a day of mousing and clicking around file browser windows.

    Command Line: explorer %p
    x Windows Program
    x Save Active File

    Then I bind it to F4. Of course, you can put it wherever you'd like.

    I thought since the file browser isn't really a "tool" people may have overlooked this possibility. Or maybe you all know about it. Or maybe it's completely useless. I don't know.

    Anyway, enjoy."

    80
    Advanced UserAdvanced User
    80

      Aug 09, 2004#2

      Does anyone know how to get Explorer to load with the "Folders" button checked? I like to have the file tree on the left.

      Thanks.

      38
      Basic UserBasic User
      38

        Aug 09, 2004#3

        toddm wrote:Does anyone know how to get Explorer to load with the "Folders" button checked?.
        Use explorer /e, %p instead.

        For a full list of switches go to Command-Line Switches for Windows Explorer

        Dan

          Aug 09, 2004#4

          Actually, you might like explorer /e,/select,%f better as it also selects the file for you.

          Dan
          Daniel Kirkdorffer
          http://www.kirkdorffer.com/

          80
          Advanced UserAdvanced User
          80

            Aug 10, 2004#5

            Thanks for the tips.

            2
            NewbieNewbie
            2

              Feb 14, 2005#6

              Cool! I'm glad to see people like this tip enough that it was carried over to the new forums.

              I liked the "select file" suggestions, so now that's how I have mine configured. My new command line is

              Code: Select all

              explorer /select,"%f"
              I don't like the explorer view, just the file folder, so no /e for me. Also, the help files say that %f returns the long version of the file name, and recommends using the quotes. And, though it looks weird, the command line options are actually delimited by commas. Maybe that lets Microsoft parse the long filenames, so %f works without the quotes.

              7
              NewbieNewbie
              7

                May 26, 2009#7

                Thanks for this info!

                A follow up question: Is there a way to get explorer to default to the project's default folder if no file is selected?

                I am using this to launch explorer:

                Code: Select all

                %SystemRoot%\explorer.exe /e,/select,%f
                which works great when a file is open. If no file is open in the editor, it defaults to the desktop. I tried using the /root switch, but this seems to override the other switches.

                Hopefully some clarification:

                With a project open in UltraEdit, but with no files open in the editor, I would like explorer to launch using the project's default directory. But, if a file is open in the editor, I would like explorer to open with the file selected as it does using the code that I provided.

                For example, if the project's default directory is c:\project\, I would like explorer to open here (instead of the desktop, which seems to be the default). But, if a file (c:\project\test.c) is open in the editor, I would like explorer to open with the file selected.

                I was previously using something like %SystemRoot%\explorer.exe /e,%rp to open to the project's default directory.

                Hope that makes sense!

                Thanks.

                6,675585
                Grand MasterGrand Master
                6,675585

                  May 26, 2009#8

                  Instead of calling explorer directly, create a batch file and pass the name of the current file and the path of the project directory to the batch file. The user tool command is:

                  "Name of batch file with full path" "%rp" "%f"

                  The batch file contains something like following:

                  @echo off
                  if "%2"=="" goto !NoFile
                  %SystemRoot%\explorer.exe /e,/select,%2
                  goto !EndBatch

                  :!NoFile
                  if "%1"=="" goto !NoProject
                  %SystemRoot%\explorer.exe /e,%1
                  goto !EndBatch

                  :!NoProject
                  %SystemRoot%\explorer.exe /e,C:\

                  :!EndBatch


                  Note 1: The user tool is now DOS program (console application) and not a Windows program (GUI application). So adapt the program type option of the user tool accordingly.

                  Note 2: I have not tested if anything written here works. I guess, it the batch file will not work correct if no project is open in UltraEdit, but a file is currently open. You can make the batch file more smart to handle also this situation.
                  Best regards from an UC/UE/UES for Windows user from Austria

                  7
                  NewbieNewbie
                  7

                    May 27, 2009#9

                    Thank you Mofi, I never thought to try a batch file.

                    Your code worked except for the actual calling of the batch file. It should be like this (no "s):

                    Code: Select all

                    "Name of batch file with full path" %rp %f
                    Thanks again.

                    6,675585
                    Grand MasterGrand Master
                    6,675585

                      May 28, 2009#10

                      Without double quotes you can pass to the batch file only project folder paths and file names which do not include a space character.

                      Explorer.exe does not need the double quotes. Explorer.exe is different to all other applications it interprets everything after the program file name as one long parameter string and the command line options are separated with / and , instead of a space. I guess Microsoft has done this to allow users to simply enter a folder path without double quotes in a command line (or double click on a folder) to start explorer with that folder path.
                      Best regards from an UC/UE/UES for Windows user from Austria