Jump to content

how 2 replace reg values via command line?


Recommended Posts

im wanting 2 do this, so i dont have 20 copies of the same .reg file with only the drive letter different.. anyone know a program or something i can use 2 replace example C: with D: ? thanks :)

@ECHO OFF
IF EXIST C:\WIN51 set CDROM=C:
IF EXIST D:\WIN51 set CDROM=D:
IF EXIST E:\WIN51 set CDROM=E:
IF EXIST F:\WIN51 set CDROM=F:
IF EXIST G:\WIN51 set CDROM=G:
IF EXIST H:\WIN51 set CDROM=H:
IF EXIST I:\WIN51 set CDROM=I:
IF EXIST J:\WIN51 set CDROM=J:
IF EXIST K:\WIN51 set CDROM=K:
IF EXIST L:\WIN51 set CDROM=L:
IF EXIST M:\WIN51 set CDROM=M:
IF EXIST N:\WIN51 set CDROM=N:
IF EXIST O:\WIN51 set CDROM=O:
IF EXIST P:\WIN51 set CDROM=P:
IF EXIST Q:\WIN51 set CDROM=Q:
IF EXIST R:\WIN51 set CDROM=R:
IF EXIST S:\WIN51 set CDROM=S:
IF EXIST T:\WIN51 set CDROM=T:
IF EXIST U:\WIN51 set CDROM=U:
IF EXIST V:\WIN51 set CDROM=V:
IF EXIST W:\WIN51 set CDROM=W:
IF EXIST X:\WIN51 set CDROM=X:
IF EXIST Y:\WIN51 set CDROM=Y:
IF EXIST Z:\WIN51 set CDROM=Z:

mkdir "%programfiles%\Foobar2000"
mkdir "%programfiles%\Foobar2000\Components"
mkdir "%programfiles%\Foobar2000\Icons"
mkdir "%AllUsersProfile%\Start Menu\Programs\Foobar2000"
xcopy "%CDROM%\Install\Apps\FooBar2000\*.*" "%programfiles%\foobar2000" /Y
xcopy "%CDROM%\Install\Apps\FooBar2000\Components\*.*" "%programfiles%\foobar2000\Components" /Y
xcopy "%CDROM%\Install\Apps\FooBar2000\Icons\*.*" "%programfiles%\foobar2000\Icons" /Y
shortcut.exe /f:"%ALLUSERSPROFILE%\Start Menu\Programs\foobar2000\Foobar2000.lnk" /a:c /t:"\Program Files\foobar2000\foobar2000.exe"
shortcut.exe /f:"%ALLUSERSPROFILE%\Start Menu\Programs\foobar2000\uninstall.lnk" /a:c /t:"\Program Files\foobar2000\uninstall.exe"
shortcut.exe /f:"%ALLUSERSPROFILE%\Start Menu\Programs\foobar2000\FooAssoc.lnk" /a:c /t:"\Program Files\foobar2000\fooassoc.exe"

IF EXIST "a:\program files\Foobar2000\Foobar2000.exe" GOTO Foobara
IF EXIST "b:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarb
IF EXIST "c:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarc
IF EXIST "d:\program files\Foobar2000\Foobar2000.exe" GOTO Foobard
IF EXIST "e:\program files\Foobar2000\Foobar2000.exe" GOTO Foobare
IF EXIST "f:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarf
IF EXIST "g:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarg
IF EXIST "h:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarh
IF EXIST "i:\program files\Foobar2000\Foobar2000.exe" GOTO Foobari
IF EXIST "j:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarj
IF EXIST "k:\program files\Foobar2000\Foobar2000.exe" GOTO Foobark
IF EXIST "l:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarl
IF EXIST "m:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarm
IF EXIST "n:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarn
IF EXIST "o:\program files\Foobar2000\Foobar2000.exe" GOTO Foobaro
IF EXIST "p:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarp
IF EXIST "q:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarq
IF EXIST "r:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarr
IF EXIST "s:\program files\Foobar2000\Foobar2000.exe" GOTO Foobars
IF EXIST "t:\program files\Foobar2000\Foobar2000.exe" GOTO Foobart
IF EXIST "u:\program files\Foobar2000\Foobar2000.exe" GOTO Foobaru
IF EXIST "v:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarv
IF EXIST "w:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarw
IF EXIST "x:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarx
IF EXIST "y:\program files\Foobar2000\Foobar2000.exe" GOTO Foobary
IF EXIST "z:\program files\Foobar2000\Foobar2000.exe" GOTO Foobarz
GOTO END
:Foobara
Regedit /S %CDROM%\Install\Reg\foobar2000a.reg
GOTO END
:Foobarb
Regedit /S %CDROM%\Install\Reg\foobar2000b.reg
GOTO END
:Foobarc
Regedit /S %CDROM%\Install\Reg\foobar2000d.reg
GOTO END
:Foobare
Regedit /S %CDROM%\Install\Reg\foobar2000e.reg
GOTO END
:Foobarf
Regedit /S %CDROM%\Install\Reg\foobar2000f.reg
GOTO END
:Foobarg
Regedit /S %CDROM%\Install\Reg\foobar2000g.reg
GOTO END
:Foobarh
Regedit /S %CDROM%\Install\Reg\foobar2000h.reg
GOTO END
:Foobari
Regedit /S %CDROM%\Install\Reg\foobar2000i.reg
GOTO END
:Foobarj
Regedit /S %CDROM%\Install\Reg\foobar2000j.reg
GOTO END
:Foobark
Regedit /S %CDROM%\Install\Reg\foobar2000k.reg
GOTO END
:Foobarl
Regedit /S %CDROM%\Install\Reg\foobar2000l.reg
GOTO END
:Foobarm
Regedit /S %CDROM%\Install\Reg\foobar2000m.reg
GOTO END
:Foobarn
Regedit /S %CDROM%\Install\Reg\foobar2000n.reg
GOTO END
:Foobaro
Regedit /S %CDROM%\Install\Reg\foobar2000o.reg
GOTO END
:Foobarp
Regedit /S %CDROM%\Install\Reg\foobar2000p.reg
GOTO END
:Foobarq
Regedit /S %CDROM%\Install\Reg\foobar2000q.reg
GOTO END
:Foobarr
Regedit /S %CDROM%\Install\Reg\foobar2000r.reg
GOTO END
:Foobars
Regedit /S %CDROM%\Install\Reg\foobar2000s.reg
GOTO END
:Foobart
Regedit /S %CDROM%\Install\Reg\foobar2000t.reg
GOTO END
:Foobaru
Regedit /S %CDROM%\Install\Reg\foobar2000u.reg
GOTO END
:Foobarv
Regedit /S %CDROM%\Install\Reg\foobar2000v.reg
GOTO END
:Foobarw
Regedit /S %CDROM%\Install\Reg\foobar2000w.reg
GOTO END
:Foobarx
Regedit /S %CDROM%\Install\Reg\foobar2000x.reg
GOTO END
:Foobary
Regedit /S %CDROM%\Install\Reg\foobar2000y.reg
GOTO END
:Foobarz
Regedit /S %CDROM%\Install\Reg\foobar2000z.reg
GOTO END
:END

Link to comment
Share on other sites


If it's just for replacing C: with %CDROM% or whatever, refer to the RunOnceEX from CD guide on the website, it should show you the syntax pretty much for REG.EXE and give you an example of usage.

Link to comment
Share on other sites

i think we're on 2 sepeate paths now :S lol im lost :)

instead of having

:Foobare

Regedit /S %CDROM%\Install\Reg\foobar2000e.reg

it would mod the original .reg file & replace C: with E: anything that will do that?

Link to comment
Share on other sites

why not to call a little vbs script via a .cmd file ?

e.g

================================

VBS script (call it foo.vbs)

it aims to install all formats

btw you can modify it

place it in ...\$OEM$\$1\Install\applications\foobar

with foobar.exe (rename it if necessary)

================================

Set WshShell = WScript.CreateObject("WScript.Shell")

On Error Resume Next

WshShell.Run ("c:\install\applications\foobar\foobar.exe /S")

WScript.Sleep 10000

WshShell.SendKeys "{DOWN}"

WScript.Sleep 800

WshShell.SendKeys "{TAB 2}"

WScript.Sleep 500

WshShell.SendKeys "{ENTER}"

WScript.Sleep 6000

WshShell.SendKeys "{SPACE}"

WScript.Sleep 500

WshShell.SendKeys "{TAB 2}"

WScript.Sleep 500

WshShell.SendKeys "{ENTER}"

WScript.Sleep 500

Wscript.Quit

================================

in the batch that you call with winnt.sif e.g

================================

ECHO Installing foobar v0.8 special

ECHO please, wait...

start /wait %systemdrive%\install\Applications\foobar\foo.vbs

00

post edited

:)

Link to comment
Share on other sites

to make it simple

Set WshShell = WScript.NOCreateObject("WScript.Shell")

On Error Resume Next

--> copy and paste it

WshShell.Run

--> too run a command

here, runs foobar install

WScript.Sleep 10000

--> pause 10000 ms = 10 sec

WshShell.SendKeys

--> DOWN = DOWN

--> TAB 2 = TAB two times

Wscript.Quit

--> to close

if you want to know the keys, make a simple install and note each key you need to install foobar you own way...

00

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