Jump to content

%CDROM% Variable


Recommended Posts


It would be better to place that file in your $OEM$\$1\TEMP folder (or whatever $1\<*> folder you choose) and run it from there via %systemdrive%\TEMP\start.cmd. %CDROM% is not a valid variable in Windows unless you set it.

Link to comment
Share on other sites

This might work you have to start this vbs file from GuiRunOnce

Save As SetCd_Passvarible_ToCmd.vbs

Dim Act, CD, Fso, strCd '''' VARIBLES FOR THE SCRIPT

Set Act = CreateObject("Wscript.Shell") '''' VARIBLE AS A OBJECT

Set Fso = CreateObject("Scripting.FileSystemObject")

Set CD = Fso.Drives

For Each strCd In CD

If strCd.DriveType = 4 Then '''' CHECKS FOR THE CD OR DVD DRIVE

If Fso.FileExists(strCd & "\win51") Then '''' THIS CONFIRM IT CORRECT CD

Act.Popup "This Is A XP CD",5,"Confirm XP CD", 0 + 32

SD = Act.ExpandEnvironmentStrings("%systemdrive%")

strFileName = (SD & "\SetCD_Var.cmd")

strFileName = Fso.GetAbsolutePathName(strFileName)

Set ts = Fso.OpenTextFile(strFileName, 2, True)

ts.WriteLine "echo off"

ts.WriteLine "set CDROM=" & strCd

ts.Close

Else

Act.Popup "This Is Not The Correct CD",5,"Incorrect CD", 0 + 32

End If

End If

Next

Then you call the cmd that is made with this one

Save As GetCdVar_Call.cmd

echo off

call %systemdrive%\SetCD_Var.cmd

echo %CDROM%

pause

What these 2 scripts do is the VBS set the CD letter and then writes the varible to

%systemdrive%\SetCD_Var.cmd then it is called by GetCdVar_Call.cmd and the

CD drive letter is passed to this cmd.

Hope this is helpfull.

Link to comment
Share on other sites

The simplest way as cluberti says is placing it with OEM folders.

If you don't use OEM folders you can place your CMD with this variable in SVCPACK.INF.

@echo off

REM find cdrom and set variable CDDRIVE
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\cdrom_nt.5 set CDDRIVE=%%i:
set WINPATH=%CDDRIVE%\
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v "CDDRIVE" /t REG_EXPAND_SZ /d ^%WINPATH%^ /f

start /wait %CDDRIVE%\defence\antivirus.exe

This should give you an example of using for installation ANTIVIRUS.EXE program that is in folder DEFENCE on installation CDROM.

Link to comment
Share on other sites

This might work you have to start this vbs file from GuiRunOnce

Save As SetCd_Passvarible_ToCmd.vbs

I dont understand you...

Where do I have to put that files on my cd ??

I dont use the $OEM methode so I cant set the files on the HD..

I want to copy the files with a *.cmd file but first I have to set the variable on

The simplest way as cluberti says is placing it with OEM folders.

If you don't use OEM folders you can place your CMD with this variable in SVCPACK.INF.

@echo off

REM find cdrom and set variable CDDRIVE
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\cdrom_nt.5 set CDDRIVE=%%i:
set WINPATH=%CDDRIVE%\
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v "CDDRIVE" /t REG_EXPAND_SZ /d ^%WINPATH%^ /f

start /wait %CDDRIVE%\defence\antivirus.exe

This should give you an example of using for installation ANTIVIRUS.EXE program that is in folder DEFENCE on installation CDROM.

How can I open SVCPACK.INF ???

I use a notepad but it dont work ?

svcpack.in_ is the file you mean ??

PS: I have a cd with SP2

I am reading on http://unattended.msfn.org/global/examples.htm and there is standing that the SVPACK file online exist without SP2 ???

" » svcpack.inf (was used for Windows XP SP1) "

Edited by Steffen
Link to comment
Share on other sites

Ok. So you should make some search and reading then :P

svcpack.in_ is an archived version of svcpack.inf. Before editing this file with Notepad you should expand it.

I would recommend you to go and grab a really great tool here _http://www.msfn.org/board/index.php?showtopic=27469&hl= This tool will give you the ability to open and pack the files from the source distributive. But please! Be careful with your experimenting with source files!

Edited by Oleg_II
Link to comment
Share on other sites

You could try adding the following under [GuiUnattended] in your winnt.sif

DetachedProgram = cmd.exe
Arguments = "/C FOR /F %? IN ('MOUNTVOL ^| FIND ":\"') DO IF EXIST %?WIN51 START %?Progs\start.cmd"

It should be two lines only!

All you would need to do from start.cmd is reference your CD-ROM drive as %~d0 or CD-ROM\Progs\ as %~dp0

Link to comment
Share on other sites

I must add first, this is only a top of the head idea, if it doesn't work, you could always try replacing the Arguments string to

Arguments = "/C FOR /F %? IN ('C D E F G H I J K L M N O P Q R S T U V W X Y Z') DO IF EXIST %?:\WIN51 START %?:\Progs\start.cmd"

Another less likely possibility in case of failure is to treat it as a batch and change all instances of %? to %%?

Link to comment
Share on other sites

I must add first, this is only a top of the head idea, if it doesn't work, you could always try replacing the Arguments string to
Arguments = "/C FOR /F %? IN ('C D E F G H I J K L M N O P Q R S T U V W X Y Z') DO IF EXIST %?:\WIN51 START %?:\Progs\start.cmd"

Another less likely possibility in case of failure is to treat it as a batch and change all instances of %? to %%?

This is standing in my winnt.sif

[GuiRunOnce]

Arguments = "/C FOR /F %? IN ('C D E F G H I J K L M N O P Q R S T U V W X Y Z') DO IF EXIST

%?:\WIN51 START %?:Install\RunOnceEx.cmd"

But i get an error after the installation is finished !!!!!

Windows cant find the file /C

Check if you have good spell it etc.........

Got you a solution

Link to comment
Share on other sites

Have you tried it this way, because he stats to treat it as a batch

Another less likely possibility in case of failure is to treat it as a batch and change all instances of %? to %%?
The way he say to try it if it fails
Arguments = "/C FOR /F %%? IN ('C D E F G H I J K L M N O P Q R S T U V W X Y Z') DO IF EXIST

%%?:\WIN51 START %%?:Install\RunOnceEx.cmd"

Link to comment
Share on other sites

  • 2 weeks later...

The following two lines work fine for me!

DetachedProgram = CMD.EXE
Arguments = "/Q /C FOR /F %? IN ('%SYSTEMROOT%\SYSTEM32\MOUNTVOL.EXE^|FINDSTR :\') DO IF EXIST %?WIN51 START %?SUPPORT\TOOLS\XTRAS\renuser.exe Administrator root"

Link to comment
Share on other sites

  • 1 year later...
The following two lines work fine for me!
DetachedProgram = CMD.EXE
Arguments = "/Q /C FOR /F %? IN ('%SYSTEMROOT%\SYSTEM32\MOUNTVOL.EXE^|FINDSTR :\') DO IF EXIST %?WIN51 START %?SUPPORT\TOOLS\XTRAS\renuser.exe Administrator root"

:thumbup

Works Like a Charm Thanks

I want to retain the Repair Installation in text mode so [unattended] and OemPreinstall is out of the question to copy SFX to %systemdrive%

During GUI Setup I wanted to extract a password protected SFX at roughly the same time as Product Key, User, Computer Name etc(T-39 to T-33).

Then bugger off and let my RunonceEx Install Reboot etc. No stupid questions to halt the install. Job Done

I can finally run my sfx off the CD Rom from Detachedprogram

Thanks

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