Skip to main content
8 events
when toggle format what by license comment
Mar 2, 2012 at 3:20 comment added MikeOnline When using %~dp0 in a command such as CD or COPY, you should enclose it in a pair of double quotes, in case the path contains a space. Same for environment variables based on %~dp0. E.G. in this answer's sample code, the third line should be cd /d "%BAT_HOME%"
Sep 25, 2010 at 6:39 comment added Benoit cd or pushd %BATH_HOME% will not work if you run a batch on a network path.
Apr 13, 2010 at 11:47 comment added ketorin You should use cd /d %BAT_HOME% instead, if the bat is in another drive. If I remember correctly, this wont work with older DOSes, though.
Sep 29, 2009 at 18:23 comment added Thomas Owens Also, I don't think %CD% existed before...XP, maybe. I know some older versions of Windows don't have it.
Nov 17, 2008 at 2:22 comment added RealHowTo %CD% is the current directory while %~dp0 is the directory where the running script is located.
Nov 14, 2008 at 6:17 comment added Saul Dolgin I usually use %CD% for this. Maybe it is not available in all DOS shell versions?
Oct 29, 2008 at 21:55 history made wiki Post Made Community Wiki by CommunityBot
Oct 29, 2008 at 0:39 history answered RealHowTo CC BY-SA 2.5