Jump to content











Photo
- - - - -

Automatically get first drive letter


  • Please log in to reply
1 reply to this topic

#1 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10511 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 11 May 2007 - 02:25 PM

I just added the possibility to automatically use the first unused drive letter even when mounting virtual disks with the command line tool. For this to work, specify #: as drive letter.

Example:

imdisk -a -s 60M -m #:

http://www.ltr-data..../imdiskinst.exe


Thanks!!

This is a good improvement.. :confused1:

One question: how should one retrieve the newly assigned drive letter? :confused1:

(I know how to detect each drive, but was thinking on just using imdisk.exe to interface with other apps/scripts in complete unnatended manner)

Any good ideas on this matter?
  • Using an environment variable (%#:%=newlyCreatedDriveLetter)
  • Outputting an errorlevel (using 0, 1, 2, 3.. - good for batch files)
  • Writing an Ini type file (good for wb scripts interaction for example)
  • Using a unique identifier (user specified) as title label when creating the image and later be able to unmount using this title label (solely using imdisk.exe to interface with these virtual disks)
:confused1:

#2 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1365 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 11 May 2007 - 02:54 PM

Thanks!!

This is a good improvement.. :confused1:

One question: how should one retrieve the newly assigned drive letter? :confused1:

(I know how to detect each drive, but was thinking on just using imdisk.exe to interface with other apps/scripts in complete unnatended manner)


Should be possible with a for statement in a batch file:

for /f "tokens=4 delims= " %%a in ('imdisk -a -s 60M -m #:') do set IMDISK_DRIVE_LETTER=%%a

Then you can use this variable IMDISK_DRIVE_LETTER later:

imdisk -d -m %IMDISK_DRIVE_LETTER%





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users