Jump to content

jjvs

Member
  • Posts

    27
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Netherlands

Posts posted by jjvs

  1. Just a little thought.

    Wouldn't it be easier to skip the whole "delims" thing and use:

    FOR /F "TOKENS=15" %%A IN ('IPCONFIG /ALL^|FIND "DHCP Server"') DO @SET DHCPSERVER=%%A

    or if you insist in using delims use this:

    FOR /F "TOKENS=2,* DELIMS=:. " %%A IN ('IPCONFIG /ALL ^| FIND "DHCP Server"') DO @SET DHCPSERVER=%%B

    BTW: Delims doesn't treat an uppercase and lowercase character the same way.

  2. Hi phaolo,

    Sometime ago I created a little batch file to restore some of the VLC file association to there previous values

    The usage:

    VLC_Extension.cmd [.extension1] [.extension2] [...]

    example: VLC_Extension.cmd .wav .wmv .asf .ts .ps

    Here it the code:

    @ECHO OFF
    SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS

    FOR %%K IN (%*) DO @(

    REM Reset variables
    SET VLC_Backup=
    SET EXT_ASSOC=

    REM Check for a backup value
    FOR /F "SKIP=4 TOKENS=3" %%F IN ('REG QUERY "HKCR\%%K" /V VLC.backup 2^>NUL') DO @SET VLC_Backup=%%F

    REM Get current file association value
    FOR /F "SKIP=4 TOKENS=4" %%F IN ('REG QUERY "HKCR\%%K" /VE 2^>NUL') DO @SET EXT_ASSOC=%%F

    REM Check if a backup value is available
    IF NOT "X!VLC_Backup!"=="X" (
    REM Check if VLC is still associated with the file extension, if true
    REM restore the old value
    IF "!EXT_ASSOC!"=="VLC!EXT_ASSOC:VLC=!" REG ADD "HKCR\%%K" /VE /D "!VLC_Backup!" /F
    REM delete VLC.backup anyway
    REG DELETE "HKCR\%%K" /V VLC.backup /F
    ) ELSE (
    REM Check if VLC is still associated with the file extension, if true
    REM remove it
    IF "!EXT_ASSOC!"=="VLC!EXT_ASSOC:VLC=!" REG DELETE "HKCR\%%K" /VE /F
    )
    )

    This batch file does check the current file association, if it's still associated with VLC it will restore it's

    previous association, or remove any association if there wasn't any before. Otherwise nothing is done.

    Good luck.

  3. Hi MillenX,,

    This is what I have in my Winnt.sif file.

    [Networking]
    InstallDefaultComponents=No

    [NetAdapters]
    Adapter1=params.Adapter1
    Adapter2=params.Adapter2

    [params.Adapter1]
    ConnectionName="The Internet"
    InfID=*
    NetCardAddress=0x0123456789AB

    [params.Adapter2]
    ConnectionName="Local NIC"
    InfID=*

    [NetProtocols]
    MS_TCPIP=params.MS_TCPIP

    [NetClients]

    [NetServices]

    [params.MS_TCPIP]
    DNS=Yes
    UseDomainNameDevolution=No
    EnableLMHosts=Yes
    AdapterSections=params.MS_TCPIP.Adapter1, params.MS_TCPIP.Adapter2

    [params.MS_TCPIP.Adapter1]
    SpecificTo=Adapter1
    DHCP=Yes
    WINS=No
    NetBIOSOptions=2

    [params.MS_TCPIP.Adapter2]
    SpecificTo=Adapter2
    DHCP=No
    WINS=No
    IPAddress=192.168.123.2
    SubnetMask=255.255.255.0
    NetBIOSOptions=2

    This will disable all NetServices and NetClients ( on all adapters/NIC's), and only install the tcpip protocol. Adapter1 will get it's settings from a DHCP server, the other one gets a static ip address.

    If you remove all sections "[params.MS_TCPIP....]" and remove the line "MS_TCPIP=params.MS_TCPIP" from the section "[NetProtocols]", you will also have no NetProtocols installed.

    I hope this will help.

  4. Try and change the command

    cd C:\Documents and Settings\%user%\Desktop\download\

    to

    cd /D C:\Documents and Settings\%user%\Desktop\download\

    This will also change your driveletter.

    Or add

    -P "C:\Documents and Settings\%user%\Desktop\download\"

    to your wget cmdline. This will download everything to the directory behind "-P".

    Hope it'll help.

    edit: Changed "-p" to '-P"

  5. Thanks, but will it "Silent" uninstall it ?

    I mean with no message prompts/confirmations ?

    Yes, but if you remove "-3" from the commandline it will ask you to uninstall or not.

    One other thing "spyblock.dll,O" is with a capital "o", not a 0 (zero), at the end.

  6. To uninstall the toolbar (after zonealarm is installed) run the following command:

    "%PROGRAMFILES%\ZoneAlarmSB\bar\1.bin\Z4highin.exe" spyblock.dll,O -3

    After running the command only 2 files will remain, but these, and the "%PROGRAMFILES%\ZoneAlarmSB" will be removed with the next reboot.

  7. Silent install (avg not started!!)

    avg_free_stf_all_8_100a1295.exe /HIDE /NO_WELCOME /NOAVGTOOLBAR /DONT_START_APPS /REMOVE_FEATURE fea_AVG_SafeSurf /REMOVE_FEATURE fea_AVG_SafeSearch /ADD_FEATURE fea_AVG_EmailPlugins /ADD_FEATURE fea_AVG_Exchange_plugin /ADD_FEATURE fea_AVG_EMC /ADD_FEATURE fea_AVG_Office_2000_plugin

    (and /ADD_FEATURE fea_AVG_Bat_plugin if you need it... (features are shown in %temp%\avg8inst.log))

    Update from folder:

    "%programfiles%\avg\avg8\avgupd.exe" /pri=4 /session=0 /source=folder /path="d:\folder_wit_bin_files"

    The update is a nice catch. I had found out about the avgupd.exe for downloading and updating, but not from folder. Since I've read your post, I've played around with the parameters. If you leave "/session=0" & "/pri=4" away. it will not bother you with questions about updating, it just does.

  8. Hi Eddie,

    I don't know if there is a switch or not, but as a workaround, you could do the following"

    While you have avg8 running, configure it as you like. Copy the files in the directory

    %ALLUSERSPROFILE%\Application Data\avg8\Cfg

    to the install directory where avg8 is stored.

    After an installation of avg8 copy these config files back to "%ALLUSERSPROFILE%\Application Data\avg8\Cfg"

    And you have avg running as you like.

    Hope it'll helps.

  9. Anyway, awesome job on the thread, but I uses RunOnceEx.cmd and cmdlines.txt inside $OEM$, working quite well.

    I store my RunOnceEx.cmd together with a minimal/generic RunOnceEx.txt in ..\Install\Other. But I also call it via the cmdlines.txt process. This will install only a couple of apps and not apply any regtweaks, or other things.

    When I install my computer I've got an configfile stored on floppy, which the commandfile will pickup (as long as no alternative configfile is specified on the commandline) and use it instead of the one on CD. This will install more apps and will apply numorous regtweaks etc.

  10. Hi,

    I've created just another RunOnceEx.cmd. Why, you may ask, well, a couple of reasons:

    • I wanted to eliminate mistakes in the syntax for adding registry keys, I sometimes "forget" to escape double quotes, or made mistakes with REG ADD %KEY%\001, typed KET instead of KEY, etc ...
    • The ability to install different apps on a real machine instead of a virtual machine. Some software I install on my real machine, will not install completely silent (PCTV Stereo from Pinnacle), I don't use something like AutoIt. BTW there is no use to install PCTV in a virtual machine.
    • I also wanted something with which I could reconfigure my apps easier.

    And this is the result.

    A command file (RunOnceEx.cmd) and a configuration file (RunOnceEx.txt = sort of ini-file).

    The syntax:

    RunOnceEx.cmd [ TEST ] [ CDdrive-letter.DRV ] [ CFGFILE.TXT ]

    TEST         : (case sensitive) Display what will happen, instead of adding registry entries.

    Letter.DRV   : If you know how to change your CDdrive-letter use this 1. Otherwise don't touch it.

    CFGFILE.TXT  : Select a different configuration file. Otherwise the commandfile will look for a RunOnceEx.txt in the same directory as the commandfile and if available A:\RunOnceEx.txt, where the last one found will be used.

    Now what will it do, the command file will process the configuration file.

    • Skip all lines starting with a #. If # is not the first character it will be part of the commandline, registry key or variable.
    • Read the CONFIG section (case sensitive), set some variables and add a few registry keys.
    • Read the other sections:
      1. Add section title to registry
      2. Add the following lines (till the next section) as commands to the registry

    Configuration file summary:

    [CONFIG]     : Config section (case sensitive)

    KEY          : Override the default KEY variable. The base key to add/update in the registry.

    NR           : Override the default NR variable. The first number (minus 1) to use. The last part of the registry subkey.

    REG_KEYS     : Override the default REG_KEYS variable. A list of KEYS (within the config section) which should be added to the registry, others will be set as variables.

    REG_KEY.type : A key which should be added to the registry of type ".type". If type is omitted it is added as a string.

    TITLE        : The title of the RunOnceEx window.

    VAR_REPLACE  : A list of variables which “names” should be converted to there “values".

    USER Vars    : Any number of variables you want to use.

    [section X]  : Start a new section (Section X, case insensitive)

    # Comment 1

    Command 1    : First command for Section X

    # Comment 2

    Command 2    : Second command for Section X

    Command x    : x-th command for Section X

    [section Y]  : Start a new section (Section Y, case insensitive)

    # Comment 3

    Command 1    : First command for Section Y

    # Comment 4

    Command x    : x-th command for Section Y

    Here is the command file: RunOnceEx.cmd

    @ECHO OFF
    SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

    REM Set variables with default values
    SET CDROM=%~d0
    SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
    SET REG_KEYS=TITLE
    SET NR=0
    SET TEST=

    REM Check commandline options
    FOR %%F IN (%*) DO @(
    REM In testmode var TEST is set, otherwise it is empty
    IF "%%~F"=="TEST" SET TEST=ECHO
    REM If you know how to change your CDdrive-letter use this 1
    IF /I "X%%~xF"=="X.DRV" SET CDROM=%%~nF:
    REM Set a alternative configuration file
    IF /I "X%%~xF"=="X.TXT" IF EXIST "%%~F" SET CFGFILE=%%~F
    )

    REM If %CFGFILE% is not set, check for RunOnceEx.txt in current dir
    REM and A:\RunOnceEx.txt, set CFGFILE to the last one found.
    IF "X%CFGFILE%"=="X" (
    FOR %%F IN ("%~dpn0.txt" "A:\%~n0.txt") DO @(
    REM Set CFGFILE to %%~F and not %%~D. %%D does not contain drive
    REM and directory info and %%F does.
    FOR /F %%D IN ('DIR /B %%F') DO @SET CFGFILE=%%~F
    )
    )

    REM Get configuration stuff (skip other sections)
    FOR /F "DELIMS== TOKENS=1,*" %%F IN (%CFGFILE%) DO @(
    REM Make sure !REG_KEYS! is set, further on we use this one and not %REG_KEYS%
    IF "X!REG_KEYS!"=="X" SET REG_KEYS=%REG_KEYS%
    REM Set FIELD1 So we can check things properly
    SET FIELD1=%%F
    REM Skip lines starting with a #
    IF NOT "X!FIELD1:~0,1!"=="X#" (
    REM Checking for Sections
    IF "X!FIELD1!"=="X[!FIELD1:~1,-1!]" (
    SET SECTION=!FIELD1:~1,-1!
    ) ELSE (
    IF !SECTION!==CONFIG (
    REM Check if entry should be added to the registry
    FOR %%R IN (!REG_KEYS!) DO @(
    IF %%R==%%~nF (
    SET REG_TYPE=%%~xF
    IF NOT "X!REG_TYPE!"=="X" SET REG_TYPE=!REG_TYPE:.=/T REG_!
    %TEST% REG ADD !KEY! /V "%%~nF" /D "%%G" !REG_TYPE! /F
    SET REG=Y
    )
    )
    REM If entry is not added to the registry set it as a variable
    IF NOT !REG!==Y SET %%F=%%G
    SET REG=
    )
    )
    )
    )

    REM Get all other sections (skip CONFIG section)
    FOR /F "DELIMS=" %%F IN (%CFGFILE%) DO @(
    SET FIELD1=%%F
    IF NOT "X!FIELD1:~0,1!"=="X#" (
    IF "X!FIELD1!"=="X[!FIELD1:~1,-1!]" (
    SET SECTION=!FIELD1:~1,-1!
    IF NOT !SECTION!==CONFIG (
    REM (Re)set variables NR & COUNT And add section to Registry
    IF !NR! LSS 100 SET NR=!NR:~-2!
    IF !NR! LSS 10 SET NR=!NR:~-1!
    SET /A NR=!NR! + 1
    IF !NR! LSS 10 SET NR=0!NR!
    IF !NR! LSS 100 SET NR=0!NR!
    SET COUNT=0
    IF NOT "X%TEST%"=="X" %TEST%.
    %TEST% REG ADD !KEY!\!NR! /VE /D "!SECTION!" /F
    )
    ) ELSE (
    IF NOT !SECTION!==CONFIG (
    REM Manipulate COUNT variable
    IF !COUNT! LSS 10 SET COUNT=!COUNT:~-1!
    SET /A COUNT=!COUNT! + 1
    IF !COUNT! LSS 10 SET COUNT=0!COUNT!
    REM Set COMMAND and "manipulate" it
    SET COMMAND=%%F
    SET COMMAND=!COMMAND:"=\"!
    FOR %%R IN (%VAR_REPLACE%) DO @(
    CALL :SET_CMD COMMAND "%%%%%%R%%%%" "%%%%R%%"
    )
    REM Add it to the registry
    %TEST% REG ADD !KEY!\!NR! /V !COUNT! /D "!COMMAND!" /F
    )
    )
    )
    )
    GOTO END

    :SET_CMD
    REM Here are variables defined in VAR_REPLACE converted from %var% to it's value
    SET %~1=!%~1:%~2=%~3!
    :END

    And here is an example configfile: RunOnceEx.txt

    [CONFIG]
    # This section uses = as a field separator
    KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
    # NR: The first number (minus 1) to use for the registry key
    NR=0
    REG_KEYS=TITLE FLAGS
    # The title of the "runonceex window"
    TITLE=Install Apps & Modify Settings
    # FLAGS: Win2k uses this for logging errors and command execution (or so I've read)
    # I couldn't find anything about xp though.
    FLAGS.dword=48
    # VAR_REPLACE
    VAR_REPLACE=CDROM DEST SYSTEMDRIVE SYSTEMROOT
    # User defined variables
    DEST=%SYSTEMDRIVE%\Apps

    [AVG Antivirus]
    # Install AVG Antivirus Free version
    %CDROM%\Install\AVG\AVG-AntiVirus.exe /HIDE /DONT_START_APPS /NO_WELCOME /NO_AVGW_STARTUP /QUIT_IF_INSTALLED /TARGET_DIR "%DEST%\AVG\Antivirus"
    # Update virus definition files
    %DEST%\AVG\Antivirus\avgw.exe /UPDATE /UPDDIR=%CDROM%\Install\AVG\binfiles

    [ZoneAlarm]
    %CDROM%\Install\ZoneAlarm\ZoneAlarm.exe /s /noreboot /installdir "%DEST%"

    [Internet Applications]
    # Install Java
    %CDROM%\Install\Java\Java.msi /qn INSTALLDIR="%DEST%\Java" NETSCAPE6=0 WEBSTARTICON=0 JAVAUPDATE=0
    # Install Opera
    %CDROM%\Install\Opera\Opera.msi /qr INSTALLDIR="%DEST%\Opera" MULTI_USER_SETTING=0

    [Office/Document Applications]
    # OpenOffice.org Version 2.3
    %CDROM%\Install\OpenOffice.org\OpenOfficeorg23.msi /qn INSTALLLOCATION="%DEST%\OpenOffice.org" SELECT_WORD=1 SELECT_EXCEL=1 SELECT_POWERPOINT=1
    # Adobe Reader
    %CDROM%\Install\AdobeReader\AdobeReader.msi /qn INSTALLDIR="%DEST%\AdobeReader"

    [Image Applications]
    # ImageMagick
    %CDROM%\Install\ImageMagick\ImageMagick.exe /DIR="%DEST%\ImageMagick" /MERGETASKS="^!desktopicon" /VERYSILENT /SP-

    [Disk and CD/DVD-image Applications]
    # Diskeeper
    %CDROM%\Install\Diskeeper\Diskeeper.msi /qn INSTALLDIR="%DEST%\Diskeeper"
    # Daemon Tools
    %CDROM%\Install\DaemonTools\DaemonTools.msi /qn TARGETDIR="%DEST%\DaemonTools" INSTALLDIR="%DEST%\DaemonTools" REBOOT=REALLYSUPPRESS

    [Reboot]
    SHUTDOWN.EXE -t 30 -r

    [CONFIG] Section explained (case sensitive)

    KEY          : If exists it overrides the default value for KEY. The base key to add/update in the registry. Default is set to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx.

    NR           : The first number to use (minus 1) for the (first)section subkey. In the example above "AVG Antivirus" is the first subkey. If you have multiple (I haven't experimented with this). It should be at least equal to the number of sections processed in all previous configfiles. Default is set to 0.

    REG_KEYS     : If exists it overrides the default value for REG_KEYS. It contains a list of KEYS which should be added to the registry instead of being set as variables. Use only the basename. Default is set to TITLE. See also REG_KEY.type.

    REG_KEY.type : An REG_KEY which should be added to the registry. If the REG_KEY doesn't contain a ".type", it will be added to the registry as a string (REG_SZ). Type can be set to dword, binary, etc, etc..

    In the above configfile FLAGS (without ".type") is added to REG_KEYS. So when the command file processes the line with FLAGS.dword, it will add "FLAGS" to the registry, it's type is "REG_DWORD", and it's value = 48 (=numeric, HEX = 0x00000030).

    TITLE        : The window title of the RunOnceEx process.

    VAR_REPLACE  : Contains a list of variables which should be replaced with their values before the commands are added to the registry. When reading from a text file %variables% aren't converted to their corresponding values by the shell (CMD.EXE). And the RunOnceEx process doesn't understand variables. So as a workaround, add all variables used in the configfile to VAR_REPLACE. There is one other thing. If a variable contains others (%DEST% => %SYSTEMDRIVE%\Apps), the variable DEST should be put before SYSTEMDRIVE in the list.

    USER VARS    : Any number of variables you want to use, and are not defined by default. For example: DEST=%SYSTEMDRIVE%\Apps (for destination).

    Examples:

    RunOnceEx.cmd                              Run in normal mode, with 1 of it's default configfiles (RunOnceEx.txt in same directory as RunOnceEx.cmd or A:\RunOnceEx.txt)

    RunOnceEx.cmd TEST                         Run in test mode with it's default configfile.

    RunOnceEx.cmd A:\ROE_%COMPUTERNAME%.txt    Run in normal mode, with an alternative configfile.

    Notes:

    1. I think that most commands you can execute on the commandline you can add to the configfile without much trouble. There are several characters which needs to be escaped though:
      - to use a &, | or !, use a ^ before the character, thus ^&, ^| or ^!
      there may be other characters, but I'm not aware of them. The command file will escape the double quotes
    2. If you run in TEST mode you can redirect the output and create a "regular" RunOnceEx.cmd.
    3. The variable CDROM will be set to the drive-letter on which the commandfile is executed.
    4. It's a little slower than a regular RunOnceEx.cmd, because it has to process a configfile into commands.

    Hint:

    If you're worried about someone copying/stealing your CD. Put a minimal configfile on CD, without any product/license info in it. And keep a configfile on a floppy which contains a list of all apps you want to install including procuct/license info.

    Give it a try. Put a configfile in the same directory as the command file and put a configfile on a floppy. Change in both files the TITLE, so you can seperate them, and run the command in test mode. If you see variables in the output from test-mode, you might have to look at VAR_REPLACE again, and add variable-names or put the one further to the front of the list.

    The attached zipfile contains 3 files: RunOnceEx.cmd, RunOnceEx.txt & "Just another RunonceEx.cmd.rtf"

    EDIT (Apr 12th): Updated the text a little, tried to make it more readable.

    EDIT (Apr 13th): After edit on the 12th backslashes were missing; put the code in a codebox

    RunOnceEx.zip

  11. Hi xenon2050,

    I run my RunOnceEx.cmd from cd. I've put the command in the directory \Install\Other on CD. In my cmdlines.txt I have the following line

    "\Install\Other\RunOnceEx.cmd"

    to execute the RunOnceEx.cmd.

    If you put your RunOnceEx.cmd in the $OEM$ directory, I think

    "RunOnceEx.cmd"

    should be sufficient. Otherwise

    "\$OEM$\RunOnceEx.cmd"

    On your other question about "OEM Pre-install switch in the winnt.sif". I'm not sure, but I thought it should be there to execute cmdlines.txt.

  12. Hi gparmar,

    I think this cmd file should do the trick

    @ECHO OFF
    SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

    REM Set the subnetmask
    SET NETMASK=255.255.255.0

    REM Retrieve "adapter name" & mac address using ipconfig
    FOR /F "DELIMS=" %%M in ('IPCONFIG.EXE /ALL') DO @(
    SET LINE=%%M
    FOR /F "TOKENS=1" %%A IN ("!LINE!") DO @(
    IF X%%A==XEthernet (
    SET ADAPTER=!LINE:Ethernet adapter =!
    SET ADAPTER=!ADAPTER::=!
    SET MAC=
    ) ELSE IF X%%A==XPhysical (
    SET MAC=!LINE:* : =!
    REM Use Adapter with double quotes to submit full adaptername as 1 parameter
    CALL :SET_IP !MAC! "!ADAPTER!"
    )
    )
    )
    GOTO END

    :SET_IP
    REM Read MAC & IP addresses from file, and if MAC is %1 set IP
    FOR /F "TOKENS=1,2" %%I IN ('TYPE "%~dp0\mac2ip.txt"') DO IF %%I==%1 SET IP=%%J
    IF DEFINED IP (
    REM Update IP address for adapter
    NETSH INTERFACE IP SET ADDRESS STATIC NAME=%2 %IP% %NETMASK%
    ) ELSE (
    ECHO MAC Address not found in %~dp0\mac2ip.txt
    )
    GOTO END

    :END

    It reads the text file mac2ip.txt which should be in the same directory as this cmd file. And the text file looks something like this:

    # MAC Address		IP Address
    00-AA-11-BB-22-CC 10.10.10.101
    00-DD-11-EE-22-FF 10.10.11.101
    00-11-22-33-44-55 10.10.12.101

    It can handle multiple ethernet adapters on one computer.

    Good luck with it

  13. Hi coucou,

    You can find a description of diskpart on the microsoft site:

    Microsoft Windows XP - Diskpart

    it's much more detailed there than what the help from the command gives you.

    I'm not very much into diskpart myself. But I've figured this out. At least it works for me. And to be fair, I haven't tested it on another computer. So I don't know if all cd/dvd drives get the same "volume nr" assigned on different computers.

    I also think, I forgot something in my last post. This is my cdrom.cmd entry within

    runonceex.cmd.

    REG ADD %KEY%\925 /VE /D "Assign driveletter Z to CD/DVD drive" /f
    REG ADD %KEY%\925 /v 1 /D "%SYSTEMROOT%\TEMP\cdrom.cmd" /f

    I hope you can do something with it.

    jjvs

  14. As far as I know, during the installation windows will first assign drive letters to all primary (main) partitions (on all attached disks) and then all logical partitions. So if you have no primary partitions on the 2nd drive it the easiest, but in any other case you'll need some tools.

    With diskmgmt.msc you get the GUI to rearrange your drive letters. There is also a commandline version "diskpart", with which you can change drive letters. But the last one is harder to do. But maybe you could figure a way out to have the drive letters rearranged before the installation is complete. I really have no idea how to figure it out myself (don't have 2 harddisk in one computer).

    I use diskpart to assign driveletter Z to my CDROM drive (during the installation).

    Here is my batch command (cdrom.cmd), which is started via runonceex.cmd:

    @echo off
    cd %SYSTEMROOT%\TEMP
    diskpart /s diskpart.txt

    this is the "diskpart.txt" file

    select volume 0
    assign letter=z
    exit

    BTW: I'll change my cdrom driveletter after i've installed apps from cd. Because I don't know what will happen when you do it earlier during installation.

  15. Hello,

    Yesterday I've found a new way to determine the cdrom drive letter during installation. It's quite simple and less typing. Replace in the RunOnceEx.cmd (or any other batchfile) the following:

    for %%a 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 %%a:\WIN51 set CDROM=%%a:

    with

    set CDROM=%~d0

    Now a little explanation for "%~d0"

    %0 (zero) is a variable which contains the filename being executed. With the "~ + a letter" you can retrieve several details about the executed file and ~d will retrieve the drive letter. Since RunOnceEx.cmd in on the CD, it returns your cdrom driveletter (assigned during installation).

    Here is a little batchfile to show you what you can do with it:

    @echo off
    echo This script will show several (hopefully) interresting things of the
    echo variable %%0
    echo.
    echo Command executed         (%%0)  : %0
    echo Directories              (%%~p0): %~p0
    echo Drive                    (%%~d0): %~d0
    echo Filename (no ext.)       (%%~n0): %~n0
    echo Extension                (%%~x0): %~x0
    echo Full path + filename     (%%~f0): %~f0
    echo Modification time (file) (%%~t0): %~t0
    echo Filesize                 (%%~t0): %~t0
    pause

    Put this in a batchfile and execute it. copy/move it to another directory (and/or drive) to see how it's effect. rename it and execute it again. This method cannot determine you cdrom driveletter when the batchfile is not stored on you CD. More info can be found in the help of the FOR command (for /?)

    It works on Win XP (Pro). I don't know about other OS'es.

    I hope you can do something with it.

×
×
  • Create New...