Wednesday, October 26, 2005

 

Another stupid batch trick part 2

A coworker astounded me today by showing me this lovely batch syntax:

set scriptname = %~n0
set scriptnamewithext = %~nx0

Damn it Microsoft, did it occur to anyone over there to document this? So frustrating. If it is documented, it's not in "help set" or the Windows XP help file. It's also nearly unsearchable due to being loaded with special characters. I did find plenty of usage of this technique on Google though so I'm probably the last one to know about it. The ones I found:

d-drive
p-path
s-short filename modifier
n-name
x-extension

Comments: Post a Comment

Links to this post:

Create a Link



<< Home

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