Monday, October 10, 2005

 

Another stupid batch trick

I had to determine the directory where a .CMD file lives from within the CMD file. This is very hard to search on. $0 has the full path (like "C:\PATH\FILE.CMD") but there didn't seem to be any other environment variables that had it.

I finally found a Microsoft article (Q121387) which shows how to find it:

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q121387

Good luck finding this one. Took me 20 minutes in Google :) The secret:

:: change to my home directory
cd $0\..
Man is that ghetto :)

Comments:
thanks
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?