Jump to content

RunOnceEx From CMDLINES ?


 Share

Recommended Posts

Hello,

I'm trying to run a batch file via unOnceEx from CMDLINES.

Here is my current CMDLINES file:

[COMMANDS]

"REGEDIT /S AllUsers.reg"

"REGEDIT /S CurrentUser.reg"

"REGEDIT /S DriveIcons.reg"

"REGEDIT /S folderSetUp.reg"

"REGEDIT /S Fonts.reg"

"REGEDIT /S icons.reg"

"REGEDIT /S IE.reg"

"REGEDIT /S MediaPlayer.reg"

"REGEDIT /S MyComputerMenu.reg"

"REGEDIT /S RegistryFavorites.reg"

"REGEDIT /S removeContextMenus.reg"

"REGEDIT /S Services.reg"

"REGEDIT /S TaskManger.reg"

"REGEDIT /S TCPIP.reg"

"REGEDIT /S Theme.reg"

"REGEDIT /S ToolBar.reg"

"REGEDIT /S WMPAssociations.reg"

"REG ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /V AutoOrder /D autoorder.vbs /F"

"SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"

"REG ADD %KEY% /V TITLE /D "Custom Windows Setup" /f"

"REG ADD %KEY%\055 /VE /D "First Run Settings" /f"

"REG ADD %KEY%\055 /V 1 /D "%windir%\system32\hide.exe /w "%systemdrive%\install\Update.cmd"" /f"

The last four lines seem to have no effect. Nothing is added to RunOnceEx. See a typo somewhere? Any ideas?

Thanks for the help,

Will

Link to comment
Share on other sites


I think the RunOnceEx must be a .cmd file?! So you must run the "RunOnceEx.cmd" from the "cmdlines.txt" and not in it.

[COMMANDS]
"RunOnceEx.cmd"

The "cmdlines.txt" and the "RunOnceEx.cmd" must be in the same folder on the CD/DVD.

Link to comment
Share on other sites

Hey,

Yeah I tried that, no luck. Batch will run fine, but nothing gets added to RunOnceEx.

Seems like a Windows bug or something..

In fact I just tried this simple test..

winnt.sif

[GuiRunOnce]

"%windir%\system32\hide.exe /w %systemdrive%\install\FIRSTRUN.cmd"

FIRSTRUN.cmd

@ECHO OFF

TITLE Preparing Custom Windows Install

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Custom Windows Setup" /f

REG ADD %KEY%\010 /VE /D "First Run Settings" /f

REG ADD %KEY%\010 /V 1 /D "%windir%\system32\hide.exe /w "%systemdrive%\install\Update.cmd"" /f

ECHO.

EXIT

Update.cmd never runs, it does not get added to RunOnceEx :(

Very strange..

cya,

Will

Link to comment
Share on other sites

» Applications that use Quotations

You will find that if you add additional " " quotation marks in the REG ADD entries, it won't be imported to the Windows Registry. To work around this, use a backslash \" for every quotation you intend to add, for example:

%KEY%\005 /V 1 /D "\"%systemdrive%\install\AdobeReader6\Adobe Reader 6.msi\" /qn" /f


By doing this, you can execute applications that contain spaces in the filename, or application switches that need to be enclosed in quotations.

If there is an application that has a series of complicated switches with lots of quotation marks, consider putting them into a separate .cmd file instead and launching from RunOnceEx, because it would get too messy putting those switches directly into RunOnceEx.

From here.

Edited by 0d14r3
Link to comment
Share on other sites

Hello,

Well, something else is going on now..

Here is the simple batch file I'm using:

@ECHO OFF
TITLE Finishing Custom Windows Install

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Finishing Custom Windows Install" /f

REG ADD %KEY%\030 /VE /D "Installing Applications" /f
REG ADD %KEY%\030 /V 1 /D "%windir%\system32\hide.exe /w \"%systemdrive%\install\finish\appz.cmd\"" /f

REG ADD %KEY%\035 /VE /D "Removing Unused Folders" /f
REG ADD %KEY%\035 /V 1 /D "%windir%\system32\hide.exe /w \"%systemdrive%\install\finish\unused.cmd\"" /f

REG ADD %KEY%\040 /VE /D "Applying Registry Settings" /f
REG ADD %KEY%\040 /V 1 /D "%windir%\system32\hide.exe /w \"%systemdrive%\install\finish\registry.cmd\"" /f

REG ADD %KEY%\045 /VE /D "Rebooting To Finish Install" /f
REG ADD %KEY%\045 /V 1 /D "%windir%\system32\hide.exe /w \"%systemdrive%\install\finish\cleanup.cmd\"" /f

REG ADD %KEY%\050 /VE /D "Deleting Install Directory" /f
REG ADD %KEY%\050 /V 1 /D "%windir%\system32\hide.exe /w \"%systemdrive%\install\finish\done.cmd\"" /f

REG ADD "HKCR\Folder\shell\List Contents\command" /ve /d "hide.exe %COMSPEC% /C DIR ""%%1\"" /B /O /S>""%%1\""\"_CONTENTS LIST.TXT"" /f

ECHO.

EXIT

Oddly enough, the title is never added to the registry. Does not matter what the title is; I know it's not spaces.

If I simply double click on the batch file the title is added correctly. Yet when it is run from a different batch file the title never gets add.

It shows up as "Windows Update" when ran. Really weird!

Thanks again,

Will

Edited by war59312
Link to comment
Share on other sites

Because you're running a batch file, the file is read before it is run and it's during this read that one or more errors are encountered.

Are you sure that you're happy with the list contents portion of the script?

Link to comment
Share on other sites

Yes list contents seems to be working as expected
That's amazing, because your syntax is wrong!

I don't know the hide.exe program your using but I'd guess from what you've got that you should need something like this:

Reg add "HKCR\Folder\shell\List Contents\command" /ve /d "Hide.exe %%ComSpec%% /c Dir/b/o/s \"%%~1\">\"%%~1\_CONTENTS LIST.TXT\"" /f

...all on one line!

You may also find this old topic useful

Link to comment
Share on other sites

This is what ends up in my registry:

@Echo off
Title Finishing Custom Windows Install

Set "R_=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"
Set "D_=HKLM\SOFTWARE\Classes\Folder\shell\Pist Contents"
Set "W_=%%SystemRoot%%\system32"
Set "S_=%%SystemDrive%%\install"

Reg add %R_% /v Title /d "Finishing Custom Windows Install" /f

Reg add %R_%\030 /ve /d "Installing Applications" /f
Reg add %R_%\030 /v 1 /d "%W_%\hide.exe /w \"%S_%\finish\appz.cmd\"" /f

Reg add %R_%\035 /ve /d "Removing Unused Folders" /f
Reg add %R_%\035 /v 1 /d "%W_%\hide.exe /w \"%S_%\finish\unused.cmd\"" /f

Reg add %R_%\040 /ve /d "Applying Registry Settings" /f
Reg add %R_%\040 /v 1 /d "%W_%\hide.exe /w \"%S_%\finish\registry.cmd\"" /f

Reg add %R_%\045 /ve /d "Rebooting To Finish Install" /f
Reg add %R_%\045 /v 1 /d "%W_%\hide.exe /w \"%S_%\finish\cleanup.cmd\"" /f

Reg add %R_%\050 /ve /d "Deleting Install Directory" /f
Reg add %R_%\050 /v 1 /d "%W_%\hide.exe /w \"%S_%\finish\done.cmd\"" /f

Reg add "%D_%\command" /ve /d ^
"Hide.exe %%ComSpec%% /c Dir/b/o/s %%1>\"%%~1\_CONTENTS LIST.TXT\"" /f

Link to comment
Share on other sites

  • 2 weeks later...

Thanks again for your help!!

I have attached hide.exe so you know what it is..

HIDE.EXE

Using my code should produce:
Hide.exe %ComSpec% /c Dir/b/o/s "C:\Program Files">"C:\Program Files\_CONTENTS LIST.TXT"

And if I run that in a command window then it creates an empty (0 bytes) file called _CONTENTS LIST in C:\Program Files .

The following installs without problem on my system:

Thanks for that idea..

Edited by war59312
Link to comment
Share on other sites

Thanks, although I'm sure you misunderstood me. I know exactly what it does, I simply have no wish now or ever to use such a thing.

I find it completely unnecessary to prevent a window flashing on the screen during an unattended installation. First of all the idea of unattended is that you don't have to sit there during the installation, so you wont see anything happen. Secondly for those who do sit there, flashing windows may help prove that something is actually happening!

What I actually meant was that because I didn't have a working knowledge of Hide.exe, I wasn't sure if for instance all of its parameters needed double quoting.

Link to comment
Share on other sites

You can use my RunOnceEx as reference/example. I also use hide.exe among other things.

Using hide.exe because when I started unattended I was all about making the installation look as clean as possible. Don't care now but never changed it.

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...