Jump to content

set drive letter for setup


Recommended Posts

I need to be able to make setup look at a drive and letter it the way I wont.

I have the letters set now but when setup starts it orgs all the drives the way it wonts.

(I have 7 partisons of drives)(C Windows: D Data: E A^2: F Free: H Han: P: Programs S Swap:)

(2 CD's)(K: L:)

(1 USB pin drive)(it sees the USB)(I:)

I have setings in the setup to install programs on P:, Swap file on S:, and the users on D:, but the setup sees the drives as:

Harddrive's C: D: E: F: G: H: I:

CD's J: K:

and USB's L:

is there a way for the setup to see the way I wont it?

Link to comment
Share on other sites


In theory, it's fine. The SUBST command disappear next boot. however, it wont work for you, as you will need to do something similar to:

D = G

E = I

F = D

and you have a connflict.

Windows defines those letters in a fixed, standard manner. I play with partition placement, and hiding until setup is completed. I do rename the CDs, and use the SUBST commnd to hold over till the reboot, but the letters I use are always available in my boxes (K, L, ... )

Link to comment
Share on other sites

But... you can change the drive letter with software like Partition Magic, so it may be possible to change it with a commandline tool, maybe diskpart.

Here ist the way it works, but you even cannot do a cross change like above and it needs reboot to get active:

Create a file named swdrvltr.cmd in $OEM$\$1\install :

@echo off
echo.
echo Searching for old drive letter...

SET VOLNUM=
FOR /F "tokens=1-3" %%A IN ('diskpart /s %~dp0vollist.txt') DO (
               If "%%~A"=="Volume" If "%%~C"=="%1" echo %%~C found as Volume %%~B
               If "%%~A"=="Volume" If "%%~C"=="%1" SET VOLNUM=%%~B
)
)

If "%VOLNUM%"=="" goto _error

echo.
echo SEL VOL %VOLNUM% >%temp%\drvltr.txt
echo REMO >>%temp%\drvltr.txt
echo a** LETTER=%2 >>%temp%\drvltr.txt
echo EXI >>%temp%\drvltr.txt

diskpart /s %temp%\drvltr.txt

del %temp%\drvltr.txt

goto _end

:_error
echo Volume with letter "%1" not found!

:_end

Create a file named vollist.txt in $OEM$\$1\install :

LIS VOL
EXI

Now you can call this in another batch file with this line:

call %systemdrive%\install\swdrvltr.cmd E P

The example line switches from E: to P:

Link to comment
Share on other sites

I am haveing a hard time understanding that. I know some Java so I know that it is looking at the 3 char's one the 1st letter, 2nd a " ", and 3rd the 2nd drive letter. and you are saying to do a test on all 3, you are looking at all letters and see if there is a Volume for that letter then test if it is the 1st letter, I think.

then you are doing something to swich the 1st to the 2nd, but I don't understand the way it works. am I right on all that?

would this work becouse it would need to be done before windows puts any programs into the programs folder?

I could maybe put a file into ever Drive named "Drive#.txt" and in the unattend.inf file have a [string] that test for the file, so it would put the programs into the right drive, but I would still need to chage anything in teh reg that does not use the %ProgramFiles% to refure to something in the program folder...I hate the ones that do that.

Link to comment
Share on other sites

@Dustinmwew

Yes, you are right with your description.

The next part you don't understand, is, that the batch file creates a silent command file for diskpart named drvltr.txt and runs it with

diskpart /s %temp%\drvltr.txt

This is like a batch file for diskpart. The used commands are only shortcuts for the real diskpart commands:

SEL = SELECT

VOL = VOLUME

REMO = REMOVE

a** = ASSIGN

etc.

It would look like this if it where a already complete TXT

SELECT VOL 3

REMOVE

ASSIGN LETTER=P

EXIT

SELECT selects the found volume with old drive letter

REMOVE "unassigns" the old drive letter

ASSIGN assigns the new drive letter

And the way how to install the programs is an experemiment. It should be possible to assign the drive letters in CMDLINES.TXT and install the software in [GUIRunOnce]. If thias method works, you dont have to change the registry entries, because after the CMDLINES.TXT is done and setup reboots, all letters are reassigned BEFORE the software(s) get installed out of [GUIRunOnce].

Link to comment
Share on other sites

To clarify my example ...

CD is originally D, you change it to K:, with an alias poining to D:, so that setup can find the files to continue. Data was originally E:, you change it to D:, with (or without) an alias to E:.

So ... does D: point to the alias of K:, the CD, or the DATA disk D: ?

Changing driver letters fron the command line is tit, but avoiding the conflicts is not.

Link to comment
Share on other sites

now I need to be able to find wich drives are named what in setup, and I will do the higher drives 1st (ex. P S) so not to have a confilt when I run this program. (I don't wont 2 drives with the same letter...)

to do that all I have to do it run the command for the later ones 1st.

thinks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...