Judas989 Posted February 26, 2005 Posted February 26, 2005 Hey everyone, I'm in need of deleting a lot of useless shortcuts created from some of my unattended setup disc, namely stuff like Favorites, Start Menu folders and links, etc. The problem is, none of the files show up until AFTER my batch file is finished and the Windows desktop & start-menu loads for the first time.Does anyone have any recommendation how to get a 2nd batch file to run after the Windows desktop loads, preferably AFTER the 1st one finishes and after an automatic reboot?Also, I'd like to add a DOS command that restarts Windows after the batch file completes. A timer would be nice too.BTW, I've searched but the search is kinda... hinky sometimes. Couldn't quite find the words to describe what I was looking for and the closest match brought up numerous different things.Thanks for the help in advanced guys.
angadsingh007 Posted February 26, 2005 Posted February 26, 2005 U can run the second batch file by using the GuiRunOnce directive in ur winnt.sif fileMore info here : http://unattended.msfn.org/global/reference.htm#guirunonce Info on automatic shutdown and reboot commands for all OS's:http://www.msfn.org/board/index.php?showtopic=40115&hl=
Judas989 Posted February 26, 2005 Author Posted February 26, 2005 Great, thanks for the info angadsingh007.Another question.If I put another batch file in the GuiRunOnce area, wont it just run right after my previous batch finishes? Or will it then load the Windows desktop THEN run the batch? I need the latter essentially and I'd test it right now but I've got a DVD-sized unattended setup and it takes a while to test.Thanks again.
angadsingh007 Posted February 26, 2005 Posted February 26, 2005 "%systemdrive%\install\batch_file1.cmd"The GuiRunOnce section is where you set the paths to batch files that run when Windows XP Setup has finished. These batch files run when the Admin account (or your own user account) is logged in.According to the above info on MSFN's guide, all the batch files should run at Admin's logon.. that is at first logon...They will run sequentially , that is one-by-one at first logon
Judas989 Posted February 26, 2005 Author Posted February 26, 2005 Hmm... my first batch file is in there, but it runs BEFORE the desktop appears. All that shows up is a DOS prompt window.Is there any way I can get a batch to run after the desktop and the toolbar appears?See, the links and files and whatnot only appear after the desktop and toolbar appear, so they cannot be deleted until then.
bryanh Posted February 26, 2005 Posted February 26, 2005 Here is just a suggestion (and of course it will cause a bunch of replies).I use AutoIt3 for ALL my installs. I wrote an AutoIt script for each install process. The last part of the AutoIt scripts does the following1) Removes any ICONS on both the "Admin" and the "All Users" desktop2) Moves ANY program groups from "Admin" to "All Users" (this way all uses have access to the program)3) SOME installs move the program groups into groupings. For example all my DVD Tools are moved into a "DVD Tools" group on my start bar.Learning AutoIt is VERY easy. Once you write a couple it very quick.
Judas989 Posted February 26, 2005 Author Posted February 26, 2005 I imagine the solution is very simple, but I'd like to see other suggestions.Thanks bryanh, but I'd like to avoid 3rd party scripts if possible.Maybe add an xcopy command in the 1st batch file to copy the 2nd batch file to the Startup folder of the admin's Start Menu? Then adding a DEL command to auto-delete the 2nd batch file for complete cleanup?
angadsingh007 Posted February 26, 2005 Posted February 26, 2005 Here is just a suggestion (and of course it will cause a bunch of replies).I use AutoIt3 for ALL my installs. I wrote an AutoIt script for each install process. The last part of the AutoIt scripts does the following1) Removes any ICONS on both the "Admin" and the "All Users" desktop2) Moves ANY program groups from "Admin" to "All Users" (this way all uses have access to the program)3) SOME installs move the program groups into groupings. For example all my DVD Tools are moved into a "DVD Tools" group on my start bar.Learning AutoIt is VERY easy. Once you write a couple it very quick.<{POST_SNAPBACK}>No need of using AutoIt. Batch will definitely do the job. This is my cleanup.cmd which runs at guirunonce :cmdow @ /HIDREM install dialup connectionscopy /y %SystemDrive%\rasphone.pbk "%allusersprofile%\Application Data\Microsoft\Network\Connections\Pbk"REM Delete shortcuts from every all user's desktopcd %ALLUSERSPROFILE%\Desktopdel /S /F /Q *.lnkdel /S /F /Q *.urlREM Delete shortcuts from every current user's desktopcd %USERPROFILE%\Desktopdel /S /F /Q *.lnkdel /S /F /Q *.urlREM Delete all user's startup itemscd "%ALLUSERSPROFILE%\Start Menu\Programs\Startup"del /Q *.*REM Delete current user's startup itemscd "%USERPROFILE%\Start Menu\Programs\Startup"del /Q *.*RD /S /Q "%systemdrive%\My Shared Folder"del %systemdrive%\IrfanView_Install.logregedit /s %SystemDrive%\cleanup.regREG DELETE HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx /fREG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx /fdel /S /F /Q "%systemdrive%\Drivers"del /S /F /Q "%systemdrive%\Applications"RD /S /Q "%systemdrive%\Drivers"RD /S /Q "%systemdrive%\Applications"REM set pathsREG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal /t REG_EXPAND_SZ /d "D:\Documents\Angad Singh" /fREG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Favourites /t REG_EXPAND_SZ /d "D:\Documents\Angad Singh\Favourites" /fdel %SystemDrive%\cddrive_init.cmddel %SystemDrive%\Drivers.exedel %SystemDrive%\wpi.cmddel %SystemDrive%\rasphone.pbkdel %SystemDrive%\phase2_init.cmddel %SystemDrive%\cleanup.regdel %SystemDrive%\cleanup.cmdEXIT@Judas989Anway, if u want to run ur batch files after loading the desktop, then copy the batch file to the startup directory (%USERPROFILE%\Start Menu\Programs\Startup)ORa tricky solution wud be to make windows run a file called "run.cmd" with guirunonce...and include in it a statementSLEEP 10CALL <ur batch file>.cmdThis way, ur script will run after 10 seconds of delay, just enough for ur desktop to have loaded
Judas989 Posted February 26, 2005 Author Posted February 26, 2005 I totally forgot about the SLEEP cmd, thanks.That might work better actually unless a batch file can delete itself after it's finished running. Does anyone know that answer?
IcemanND Posted February 26, 2005 Posted February 26, 2005 put a script in the adminstrators startup folder, it runs after the desktop is loaded. then you just delete it at the end of the script.
angadsingh007 Posted February 26, 2005 Posted February 26, 2005 I totally forgot about the SLEEP cmd, thanks.That might work better actually unless a batch file can delete itself after it's finished running. Does anyone know that answer?<{POST_SNAPBACK}>Yes, a batch file can very well delete itself...But all commands written there after that "del" command, no command will get executed.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now