Jump to content

RunOnceEx and Batch Files


_jd_

Recommended Posts

I'm using RunOnceEx to do some tasks but i'm seeing some unexpected behaviour. The actions called via RunOnceEx consists of a batch file (contains a start /wait setup.exe and several directly related reg add calls to configure the installed app) then a few seperate unrelated command line calls (e.g.: rmdir, reg add/delete, some net stuff, etc). Because it's all processed by cmd as RunOnceEx is processed several command windows pop up... i'd like to get a handle on them.

I modified the RunOnceEx entries to run the actions using "%COMSPEC% /c start /min" and that seems to control the command windows by minimizing them as they're opened. What's unexpected is that the start /wait in my batch file no longer waits with the parent window being minimized. I tried modifying the start /wait in the batch file by adding /b in the hopes that running the setup.exe in the minimized parent window would allow the /wait to actually wait. It didn't.

So, some pointers would be appreciated. If I don't minimize the window in which the batch file runs then start /wait setup.exe works fine and waits.

If i've lost anyone, let me know. :)

Link to comment
Share on other sites


Here's an export of RunOnceEx:

-----

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx]

"Title"="Additional Tasks (HP dc7600)"

"Flags"=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx001]

@="Roxio DigitalMedia Plus 7.2"

"1"="C:\\temp\\postimage\\hp\\roxio\\dmp\\7.2\\INSTALL.CMD"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\9999]

@="Finalizing"

"1"="C:\\WINDOWS\\system32\\cmd.exe /c rmdir /s /q C:\\temp\\postimage"

"2"="C:\\WINDOWS\\system32\\net.exe user <username> /delete"

"3"="C:\\WINDOWS\\system32\\reg.exe delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon\" /v AutoAdminLogon /f"

"4"="C:\\WINDOWS\\system32\\reg.exe delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon\" /v DefaultUserName /f"

"5"="C:\\WINDOWS\\system32\\reg.exe delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon\" /v DefaultPassword /f"

"6"="C:\\WINDOWS\\system32\\shutdown.exe -r -t 0 -f"

-----

As I mentioned, the batch file (INSTALL.CMD) simply contains a "start /wait setup.exe /s" and some calls to reg.exe to configure the application being installed.

Edited by _jd_
Link to comment
Share on other sites

I cannot see any start /min commands there at all!

From what you've posted, you should only have two command windows open

  • one for install.cmd which will stay open during its execution, may be a while
  • one for the rmdir command which will flash open and off very quickly

At the moment I am guessing that you are asking for a fix for problems arising from install.cmd, but posted a registry export form a different files execution. So why not post the runonceex file and install.cmd instead of giving mixed messages to us and sitting back waiting for the guesses to come in.

Link to comment
Share on other sites

You can use any one of several methods of hiding console windows, but the fact remains that you should be looking at reducing them or removing them completely. I will guess that correctly coding the ellusive install.cmd would be the most appropriate measure to take in the first instance.

The MSFN community is a two way deal, you want us to give you help, we would like you to help us to help you by providing us with something too.

If you're worried about allowing the whole world to see your file content, just upload it as an attachment as I previously asked. This way only your fellow members will be able to access the file.

Link to comment
Share on other sites

The contents of RunOnceEx is what i'm currently using. Insertion of "start /min" was only done temporarily to test functionality - I don't have a copy of it but the modifications were to simply prefix each RunOnceEx action with "%COMSPEC% /c start /min ". I will edit my earlier post accordingly.

As for install.cmd, it contains:

@echo off

cls

echo "%date%:%time%:POST CLONE:Installing Roxio DigitalMedia Plus 7.2" >> C:\distribution.log

start /wait %SYSTEMDRIVE%\temp\postimage\hp\roxio\dmp\7.2\setup.exe /qn REBOOT=ReallySuppress

reg add "HKLM\SOFTWARE\Sonic\Registration\CinePlayer" /v "RunRegApp" /t "REG_DWORD" /d "00000002" /f

reg add "HKLM\SOFTWARE\Sonic\Registration\DLA" /v "RunRegApp" /t "REG_DWORD" /d "00000002" /f

reg add "HKLM\SOFTWARE\Sonic\Registration\SCAudio" /v "RunRegApp" /t "REG_DWORD" /d "00000002" /f

reg add "HKLM\SOFTWARE\Sonic\Registration\SCCopy" /v "RunRegApp" /t "REG_DWORD" /d "00000002" /f

reg add "HKLM\SOFTWARE\Sonic\Registration\SCData" /v "RunRegApp" /t "REG_DWORD" /d "00000002" /f

reg add "HKLM\SOFTWARE\Sonic\Registration\SCMain" /v "RunRegApp" /t "REG_DWORD" /d "00000002" /f

reg add "HKLM\SOFTWARE\Sonic\CinePlayer\1.5" /v "PerfWarn" /t "REG_DWORD" /d "00000000" /f

reg add "HKLM\SOFTWARE\Sonic\CinePlayer\1.5" /v "FileAssociationsDontAsk" /t "REG_DWORD" /d "00000001" /f

reg add "HKLM\SOFTWARE\Sonic\CinePlayer\1.5" /v "DVDAutoPlayDontAskApp" /t "REG_SZ" /d "" /f

exit

Link to comment
Share on other sites

You just need to change your installation methodology a little.

Currently the most irritating thing must be the length of time that the console window is visible due to the wait during the DMP installation. Therefore don't install DMP from install.cmd, install it directly from runonceex.cmd, then run the additional associated registry entries from runonceex too using a registry file with `regedit /s`.

That way you'll only get a cmd window for the rmdir command, but it will flash on and off so quickly it'll be hardly noticeable. The only other window, if you really need it, would be caused by your appending of date and time to the log. Of course both of these could still be done using vbs or similar without producing console windows too.

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