windowsscriptingcmd

How do I open an Explorer window in a given directory from cmd.exe?


I see how to launch many other programs from a batch file, but I can't find a command like open on Mac OS X. Does such a tool exist on Windows? Powershell, or a Windows API call from an executable would also work.

Or, put another way, how can I invoke Windows default "Open" handler for a file from a batch file or powershell script?


Solution

  • In Windows you can open Explorer with the following command:

    C:\Users\Leniel>start %windir%\explorer.exe
    

    If you want it to open a specific folder, do this for example:

    C:\Users\Leniel>start %windir%\explorer.exe "C:\Users\Leniel\Desktop"