Sign In
Mark Yocom's Script Tips
Scripting tips, covering batch, VBScript, and the occasional Perl script.
Translate This Page
Translate this page
Powered by
Microsoft® Translator
Options
Blog Home
Share this
RSS for posts
Atom
RSS for comments
Search
Advanced search options...
Search In:
Everything
Blogs
Forums
People
Groups
Places
Pages
Date range:
All Time
Last Year
Last 6 Months
Last 3 Months
Last Month
Last Week
Last Two Days
Tags
Batch
Deep Thoughts
Resources
VBScript
Archive
Archives
January 2008
(1)
August 2006
(1)
July 2006
(1)
May 2006
(1)
September 2005
(2)
June 2005
(14)
Evolution of a solution
MSDN Blogs
>
Mark Yocom's Script Tips
>
Evolution of a solution
Evolution of a solution
Mark Yocom [MSFT]
1 Oct 2005 1:15 AM
Comments
2
The other day, someone posted a message at work asking for a way to find out the drive letter for partition 1 on the first disk.
The first response offered this:
C:>echo list volume | diskpart
Microsoft DiskPart version 5.1.3565
Copyright (C) 1999-2003 Microsoft Corporation.
On computer: SINISTAR
DISKPART>
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 F DVD-ROM 0 B
Volume 1 C BOOTDRIVE FAT32 Partition 9 GB Healthy System
Volume 2 D Application NTFS Partition 15 GB Healthy Pagefile
Volume 3 E SharedAndUn NTFS Partition 10 GB Healthy
DISKPART>
C:\>
The original poster then asked if anyone already had a script to parse the output of diskpart. I helpfully offered this:
@for /f "tokens=3" %%x in ('echo list volume ^| diskpart ^| findstr /c:"Volume %1"') do @echo %%x
"How clever of me," thought I. "Simply pass in a volume number and it neatly spits out the drive letter." I was all proud of myself until someone pointed out that we already had a perfectly good .exe that did the same thing.
The moral? It's all fun and games 'til you find out you just reinvented the wheel...
2 Comments
Batch
Blog - Comment List MSDN TechNet
Comments
Loading...