Jul 8

I nabbed this one from Lifehacker.   Instead of having to hard code paths in batch scripts you can use the variable %~dp0 to signify the working directory of the script itself.   Now, I usually try not to be a zealot and bash on windows much especially since I started working at a computers that is very windows centric,  but damn man!  One of windows greatest weaknesses is lack of a really good command line and ‘%~dp0′ is a perfect example of that.  Though I will be using that variable in scripts to come :D

If you use “%~dp0″ (sans quotes) in a batch file, this will point to the batch file’s path. For example :

SET MAC=00:00:00:00:00:00
%~dp0mc-wol.exe %MAC%

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.