Can you help me make a .cmd file that I can use which will open the 2015 folder on my Desktop so I can put it on my taskbar.
Asked
Active
Viewed 4,461 times
2 Answers
2
If all you're using the batch file for is to open the folder, then this is a classic X-Y problem because no batch file is required for this simple task.
- Right-click the folder and select Create shortcut
- Right-click the shortcut, select Properties and in the Target field just add "explorer.exe " before the full path to the folder (note that there's a space after explorer.exe)
- You can also modify the shortcut's name and icon as required (optional)
- Right-click the shortcut and select Pin to Taskbar
- Now the shortcut itself can be deleted since it's already been pinned
There you have it - a direct shortcut on your taskbar to the folder in question with no batch file required.
Karan
- 55,947
- 20
- 119
- 191
1
How can I open a folder on my desktop using explorer in a batch file?
The following batch file will open explorer with your deskop folder "2015"
@echo off
explorer %USERPROFILE%\Desktop\2015
I can't put batch files on my taskbar though
Yes, you can:
- Create a shortcut to the batch file.
- Right click on the short cut and choose
Properties - Change
targettocmd.exe /C "path to batchfile" - Drag the shortcut to the taskbar.
It should now be pinnable.
DavidPostill
- 153,128
- 77
- 353
- 394
-
I can't put batch files on my taskbar though... – Rydog Mar 24 '15 at 10:32
-
You asked "Can you help me make a cmd file". A `cmd` file **is** a batch file :/ – DavidPostill Mar 24 '15 at 10:53
-
@Rydog see updated answer. – DavidPostill Mar 24 '15 at 11:15
-
(1) `%USERPROFILE%\Desktop` should generally be equivalent to `C:\Users\%username%\Desktop` and may be more reliable. (2) [This answer](http://superuser.com/a/306582/150988) describes a slightly longer procedure for pinning `.bat` files directly to the taskbar. In short: rename `foo.bat` to `foo.exe`, pin it, and rename it back. – Scott - Слава Україні Mar 24 '15 at 12:05
-
@Scott Do you have evidence for the "more reliable"? – DavidPostill Mar 24 '15 at 12:14
-
Well, I said "***may*** be" -- but, isn't it possible to put users' home directories in `D:\Users`? – Scott - Слава Україні Mar 24 '15 at 12:16
-
2`%userprofile%` is more reliable, because in older versions of Windows (eg. XP), the user home directory is located in `C:\Documents and Settings` directory – Mar 24 '15 at 12:36
-
answer updated again :/ – DavidPostill Mar 24 '15 at 12:38
-
@David: At the risk of beating a dead horse, see this wacky outlier: [Creating User Account Named 'Con'](http://superuser.com/a/915784/150988). – Scott - Слава Україні May 20 '15 at 08:16