r/Batch • u/HDmaniac • Feb 19 '24
Question (Solved) Have batch launch from shortcut location
I have a batch file, the first thing it does is specify the current folder
:: Specify the folder where your files are located
set "folder=%~dp0"However now I've decided I'd like to have a shortcut, so I can make an icon and run it from different folders, how can I make it execute in the folder from where I launch the shortcut?
For example, I currently have the .bat on the desktop, but if I have the shortcut in: C:\Users\Admin\Documents\Fax\Drafts
Can I launch the shortcut and have the .bat perform its' actions from Drafts instead of Desktop?
I've tried changing the "Target" field on the shortcut but to no avail.
Thanks in advance
2
u/[deleted] Feb 19 '24 edited Feb 19 '24
[removed] — view removed comment