Main menu:

Site search

Categories

January 2018
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031  

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!