Open a folder with File explorer using .bat

Batch File

Batch File Problem Overview


What command should I use to open a specified path at the end of program.

start "c:\Yaya\yoyo\"

Is not working

Batch File Solutions


Solution 1 - Batch File

You can try like this:

%SystemRoot%\explorer.exe "c:\Yaya\yoyo\"

Solution 2 - Batch File

I think it should be this:

explorer c:/Yaya/yoyo

Solution 3 - Batch File

The start command needs blank quotes at the beginning, as it uses the first double quoted phrase as the "Window title"

start "" "c:\Yaya\yoyo\"

Solution 4 - Batch File

Open notepad and type

START C:\Yaya\yoyo\

Save as: filename.BAT

Edit: Some people have reported a string after the START keyword, wrapping the path inside double quotes is better as the path can have files/folder names with spaces.

 START "" "C:\Yaya\yoyo\"

In newer systems, For example, Windows 10 title is ignored because CMD opens and closes in the blink of any eye. The syntax for starting a new process is

Syntax

START "title" [/D path] [options] "command" [parameters]

Wherein

  • title - Text for the CMD window title bar (required.)
  • path - Starting directory.
  • command - The command, batch file or executable program to run.
  • parameters - The parameters passed to the command.

Solution 5 - Batch File

Here are two examples to open folders, one in the location and the other with the folder selected in the parent directory.

:: Open an Explorer window with the 'temp' folder displayed and its parent hidden:
Explorer.exe /e,/root,"%temp%"

:: This one will open the parent directory and automatically select the 'temp' folder:
Explorer.exe /select,"%temp%"

:: See more examples here: https://ss64.com/nt/explorer.html
See more examples here: https://ss64.com/nt/explorer.html

Solution 6 - Batch File

Method 1

start  "" "your directory or File"

eg:-

start  "" "E:\Code SAmple\"

enter image description here

Mehtod 2

%SystemRoot%\explorer.exe  "your directory or File"

eg:-

 %SystemRoot%\explorer.exe  "E:\Code SAmple\"

enter image description here

Reference:-

https://stackoverflow.com/a/50266001/7706354

https://stackoverflow.com/a/20202906/7706354

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDebView Question on Stackoverflow
Solution 1 - Batch FileRahul TripathiView Answer on Stackoverflow
Solution 2 - Batch FileDanView Answer on Stackoverflow
Solution 3 - Batch FilefoxidriveView Answer on Stackoverflow
Solution 4 - Batch Fileits4zahoorView Answer on Stackoverflow
Solution 5 - Batch FileSteView Answer on Stackoverflow
Solution 6 - Batch FilelavaView Answer on Stackoverflow