Open a folder with File explorer using .bat
Batch FileBatch 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
https://ss64.com/nt/explorer.html
See more examples here:Solution 6 - Batch File
Method 1
start "" "your directory or File"
eg:-
start "" "E:\Code SAmple\"
Mehtod 2
%SystemRoot%\explorer.exe "your directory or File"
eg:-
%SystemRoot%\explorer.exe "E:\Code SAmple\"
Reference:-