Main menu:

Site search

Categories

June 2017
M T W T F S S
« Feb    
 1234
567891011
12131415161718
19202122232425
2627282930  

Tags

Blogroll

Windows Command Scripting Gems

Over the last few weeks I have been extending my knowledge of Windows Command Scripting, or to simple folks, writing batch files.  A few things really annoy me, like when people cannot grasp that something has changed.  News flash the acronym PCMCIA went away years ago when the decided to call it PC Card, cmd is a replacenment for the old command prompt, and batch files (.bat) have been passe for a long time now with command scripts (.cmd) being introduced in Windows NT 4.

As I have been trying to learn better ways of doing things I wondered today how I could find the current drive letter the command script was being called from.  I found people questioning it, I thought about writing an elaborate script to set a variable and parse it, but finally I found Rob van der Woude’s Scripting Pages which had the reference I needed.  What is the answer?  ”%~d0″  Now how in the world would anyone ever guess or figure out that %~d0 returns the drive of the current command script?

Write a comment

You need to login to post comments!