Jump to content

Unattended.bat file CD Drive letter discovery how to


Recommended Posts

Hi,

I'm new to the forum and i am confused on how does Windows Setup know what letter has my cd drive?, What if i add another CD-drive or do an uninstall on another pc with many CD-DRIVES

May I modify the unattended.bat CD letter as follow:

FROM:

set AnswerFile=.\unattend.txt

set SetupFiles=k:\amd64

K:\amd64\winnt32 /s:%SetupFiles% /unattend:%AnswerFile% /copysource:lang

TO:

set AnswerFile=.\unattend.txt

set SetupFiles=%CDROM%:\amd64

%CDROM%:\amd64\winnt32 /s:%SetupFiles% /unattend:%AnswerFile% /copysource:lang

thanks for your response in advanced.

Link to comment
Share on other sites


Perhaps try this in your bat


@Echo Off
CLS
Mode 62, 9
Color F9

Set Char=C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:

for %%i in (%Char%) do if exist %%i\SETUP.exe Goto Confirm

for %%i in (%Char%) do if not exist %%i\SETUP.exe Goto Missing

:Confirm
set CDROM=%%i
set AnswerFile=.\unattend.txt
set SetupFiles=%CDROM%:\amd64

%CDROM%:\amd64\winnt32 /s:%SetupFiles% /unattend:%AnswerFile% /copysource:lang

Goto TheEnd

:Missing
set CDROM=Error Unknown Occur
CLS
Echo.
echo %CDROM%
pause
Goto TheEnd

:TheEnd
Exit

Link to comment
Share on other sites

Perhaps try this in your bat


@Echo Off
CLS
Mode 62, 9
Color F9

Set Char=C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:

for %%i in (%Char%) do if exist %%i\SETUP.exe Goto Confirm

for %%i in (%Char%) do if not exist %%i\SETUP.exe Goto Missing

:Confirm
set CDROM=%%i
set AnswerFile=.\unattend.txt
set SetupFiles=%CDROM%:\amd64

%CDROM%:\amd64\winnt32 /s:%SetupFiles% /unattend:%AnswerFile% /copysource:lang

Goto TheEnd

:Missing
set CDROM=Error Unknown Occur
CLS
Echo.
echo %CDROM%
pause
Goto TheEnd

:TheEnd
Exit

Thanks for your response, I'll give it a try.

Link to comment
Share on other sites

u can use the following code in your bat file

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

echo off

cls

for /f "tokens=3" %%i IN ('reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup /v "SourcePath" ^| findstr "REG_SZ"') do set SOURCE=%%i

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

so u can point to files on your disk as

eg.,

echo Installing Directx 9c

%source%\i386\svcpack\dx.exe

Link to comment
Share on other sites

  • 6 months later...

Perhaps try this in your bat


@Echo Off
CLS
Mode 62, 9
Color F9

Set Char=C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:

for %%i in (%Char%) do if exist %%i\SETUP.exe Goto Confirm

for %%i in (%Char%) do if not exist %%i\SETUP.exe Goto Missing

:Confirm
set CDROM=%%i
set AnswerFile=.\unattend.txt
set SetupFiles=%CDROM%:\amd64

%CDROM%:\amd64\winnt32 /s:%SetupFiles% /unattend:%AnswerFile% /copysource:lang

Goto TheEnd

:Missing
set CDROM=Error Unknown Occur
CLS
Echo.
echo %CDROM%
pause
Goto TheEnd

:TheEnd
Exit

Thanks a lot !!

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...