in reply to Re^2: How to change the drive letter for a CD/DVD drive on Windows?
in thread How to change the drive letter for a CD/DVD drive on Windows <b>Update: with a script</b>?

Take a look at the diskpart command. Specifically, the assign subcommand and the /s scripting switch.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

Replies are listed 'Best First'.
Re^4: How to change the drive letter for a CD/DVD drive on Windows?
by matze77 (Friar) on Dec 04, 2009 at 15:38 UTC

    Thx. That was it. Since DVD/CD Drives seem to be volume 0 it is as simple as:
    diskpart /s script.txt

    script.txt: select volume=0 assign letter=R list volume

    Thanks
    MH
    You saved my day ...

      You might want to at least consider the possibility of multiple drives or other volume assignments:

      #! perl -slw use strict; my @vols = split "\n", `diskpart /s listvol.txt`; print for @vols;

      Where listvoe.txt contains:

      list volume

      Will get you the volume list. You can then grep on /ROM/ and tease the line(s) apart to get the volume number.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        Perfect.Good idea to get a safety net. It seems it could be also "DVD" i wonder if "blue ray" e.g. produce another output,
        but so far it will work since or new machines only got DVD-ROM drives ...

        list volume: Volume 0 R DVD
        Thanks
        MH