Jump to content

Run multiple RunOnceEx commands


twrizzo

Recommended Posts

I want to be able to select the applications that are installed using a simple batch file using the choice command. During the cmdlines.txt portion of Windows setup I prompt the user with a choice as to which apps they want to install. The batch file times out after a couple of minutes and only adds the required software to the RunOnceEx.

I also add another batch file to the RunOnceEx to prompt the user again as to what software they want installed so that at the end of the RunOnceEx it will prompt them again and update the RunOnceEx with the additional registry entries.

The problem that I am having is that if I add to the RunOnceEx during its execution, the title portion gets erased when it finishes and the additional commands are not executed.

Is there an easier way to update the RunOnceEx?

Any help would be greatly appreciated!

Link to comment
Share on other sites


I figured it out. If I have it timeout in my original batch file and install the default apps, I have to insert a new batch file in the RunOnceEx at a lower number than at the point at which it was executed in the original RunOnceEx.

For example if I Install apps in the RunOnceEx at keys 10, 20 and 30 and I want to prompt the user with with another batch file at the next logon, I have to put it in a key less than 10 or else it will be executed after the command in RunOnceEx key 30 is.

Each of the addition batch files, AllRunonceEx, MISRunonceEX, and PCRunonceEx all have their own individual RunOnceEx settings.

cmdlines.txt

[COMMANDS]
"useraccounts.cmd"
"Run-Once.cmd"

Run-Once.cmd

@echo off
color 1f
title New Computer Setup
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º New Computer º
echo º º
echo º October 27, 2006 º
echo º º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º º
echo º Choose an option to automatically install º
echo º all of your applications on next reboot. º
echo º º
echo º L - Laptop º
echo º M - MIS Laptop º
echo º P - Standard PC º
echo º T - Timeout - Will prompt again º
echo º X - Do not install any software º
echo º º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
choice /C:LMPTX /T:T,300
IF ERRORLEVEL == 5 GOTO EXIT
IF ERRORLEVEL == 4 GOTO TIMEOUT
IF ERRORLEVEL == 3 GOTO PC
IF ERRORLEVEL == 2 GOTO MIS
IF ERRORLEVEL == 1 GOTO LAPTOP

:LAPTOP
Echo Running LAPTOP RunOnceEx
Title Laptop Setup
cmdow /run /hid C:\install\AllRunOnceEx.cmd
cmdow /run /hid C:\install\LaptopRunOnceEx.cmd
color 5f
cls
echo.
echo.
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º LAPTOP SETUP º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º º
echo º Your apps will be installed the next time you log on. º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
Sleep 3
rem cmdow /run /hid C:\install\Prompt_for_CD.vbs
Goto Exit

:MIS
Echo Running MIS LAPTOP RunOnceEx
Title MIS Laptop Setup
color D1
cls
echo.
echo.
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º MIS LAPTOP SETUP º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º º
echo º Your apps will be installed the next time you log on. º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
Sleep 3
rem cmdow /run /hid C:\install\Prompt_for_CD.vbs
cmdow /run /hid C:\install\AllRunOnceEx.cmd
cmdow /run /hid C:\install\MISRunOnceEx.cmd
Goto Exit



:PC
Echo Running PC RunOnceEx
Title PC Setup
color 2f
cls
echo.
echo.
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º PC SETUP º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º º
echo º Your apps will be installed the next time you log on. º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
Sleep 3
rem cmdow /run /hid C:\install\Prompt_for_CD.vbs
cmdow /run /hid C:\install\AllRunOnceEx.cmd
cmdow /run /hid C:\install\PCRunOnceEx.cmd
Goto Exit


:TIMEOUT
cls
Title No Install Selected
color E0
echo.
echo.
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º No Install Selected º
echo º Installing Default Applications º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º º
echo º You will be prompted again on next logon º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
Sleep 3
cmdow /run /hid C:\install\AllRunOnceEx.cmd
cmdow /run /hid reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx" /v "TITLE" /t REG_SZ /d "Installing Programs" /f

rem ****************************************************************************************
I add the batch file to prompt the user for what software they want at the end of the already executing RunOnceEX

cmdow /run /hid reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\999" /v "Run-Once" /t REG_SZ /d "C:\Install\Run-Once2.cmd" /f

rem ***************************************************************************************

Goto Exit

:QUIT
cls
Title Quitting
color CF
echo.
echo.
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º QUITTING º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
Sleep 3
Goto Exit

:EXIT
Exit

Run-Once2.cmd

@echo off
color 4f
title New Computer Setup
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º New Computer º
echo º º
echo º October 27, 2006 º
echo º º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º º
echo º Choose an option to automatically install º
echo º all of your applications on next reboot. º
echo º º
echo º L - Laptop º
echo º M - MIS Laptop º
echo º P - Standard PC º
echo º T - Timeout - Will prompt again º
echo º X - Do not install any software º
echo º º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
choice /C:LMPTX
IF ERRORLEVEL == 5 GOTO EXIT
IF ERRORLEVEL == 4 GOTO TIMEOUT
IF ERRORLEVEL == 3 GOTO PC
IF ERRORLEVEL == 2 GOTO MIS
IF ERRORLEVEL == 1 GOTO LAPTOP

:LAPTOP
rem Echo Running LAPTOP RunOnceEx
Title Laptop Setup
color 5f
cls
echo.
echo.
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º LAPTOP SETUP º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º º
echo º Your apps will be installed the next time you log on. º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
Sleep 3
rem cmdow /run /hid C:\install\Prompt_for_CD.vbs
cmdow /run /hid C:\install\LaptopRunOnceEx.cmd
Goto Exit

:MIS
rem Echo Running MIS LAPTOP RunOnceEx
Title MIS Computer Setup
color D1
cls
echo.
echo.
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º MIS COMPUTER SETUP º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º º
echo º Your apps will be installed the next time you log on. º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
Sleep 3
rem cmdow /run /hid C:\install\Prompt_for_CD.vbs
cmdow /run /hid C:\install\MISRunOnceEx.cmd
cmdow /run /hid C:\install\Log-Off.vbs
Goto Exit



:PC
rem Echo Running PC RunOnceEx
Title Standard PC Setup
color 2f

cls
echo.
echo.
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º STANDARD PC SETUP º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º º
echo º Your apps will be installed the next time you log on. º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
Sleep 3
rem cmdow /run /hid C:\install\Prompt_for_CD.vbs
cmdow /run /hid C:\install\PCRunOnceEx.cmd
cmdow /run /hid C:\install\Log-Off.vbs
Goto Exit


:TIMEOUT
cmdow @ /HID
cmdow /run /hid reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx" /v "TITLE" /t REG_SZ /d "Installing Programs" /f


rem *************************************************************************************
I add the batch file to prompt the user for what software they want at the beginning of the RunOnceEX

cmdow /run /hid reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\001" /v "Run-Once" /t REG_SZ /d "C:\Install\Run-Once2.cmd" /f

rem *************************************************************************************

cls
Title No Install Selected
color E0
echo.
echo.
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º No Install Selected º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º º
echo º You will be prompted again on next logon º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
Sleep 3
Goto Exit

:QUIT
cls
Title Quitting
color CF
echo.
echo.
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º QUITTING º
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
Sleep 3
Goto Exit

:EXIT
Exit

Link to comment
Share on other sites

cmdow /run /hid reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx" /v "TITLE" /t REG_SZ /d "Installing Programs" /f

There is no reason to use cmdow for this, instead use:

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx" /v "TITLE" /t REG_SZ /d>nul

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