Sgt_Strider Posted June 9, 2005 Share Posted June 9, 2005 This is how my RunOnceEx.cmd file looks like:@echo offSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY%\005 /VE /D "Removing Favorites" /fREG ADD %KEY%\005 /V 1 /D "RD /S /Q \"%systemdrive%\Documents and Settings\Administrator\Favorites\Links\"" /fREG ADD %KEY%\005 /V 2 /D "RD /S /Q \"%systemdrive%\Documents and Settings\Administrator\Favorites\Favorites\"" /fREG ADD %KEY%\999 /V 1 /D "RD /S /Q %systemdrive%\drivers\" /fI get an error after Windows finish installing itself and the RunOnceEx.cmd files attempt to initialized the commands in the file. What I am trying to do is remove the favourites and links folder in Internet Explorer and the drivers installed via the winnt.sif method. If anyone here can figure out why the script isn't working and can correct it, that would be greatly appreciated. Thanks! Link to comment Share on other sites More sharing options...
OrcoXP Posted June 9, 2005 Share Posted June 9, 2005 ummm....and the error is what? Link to comment Share on other sites More sharing options...
Yzöwl Posted June 9, 2005 Share Posted June 9, 2005 (edited) RD is not a recognised command unless run from the command interpreter.@echo offSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY%\005 /VE /D "Removing Favorites" /fREG ADD %KEY%\005 /V 1 /D "cmd /c rd /s/q \"%userprofile%\Favorites\Links\"" /fREG ADD %KEY%\005 /V 2 /D "cmd /c rd /s/q \"%userprofile%\Favorites\Favorites\"" /fREG ADD %KEY%\999 /V 1 /D "cmd /c rd /s/q %systemdrive%\drivers" /f Edited June 9, 2005 by Yzöwl Link to comment Share on other sites More sharing options...
Sgt_Strider Posted June 9, 2005 Author Share Posted June 9, 2005 (edited) RD is not a recognised command unless run from the command interpreter.@echo offSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY%\005 /VE /D "Removing Favorites" /fREG ADD %KEY%\005 /V 1 /D "cmd /c rd /s/q \"%userprofile%\Favorites\Links\"" /fREG ADD %KEY%\005 /V 2 /D "cmd /c rd /s/q \"%userprofile%\Favorites\Favorites\"" /fREG ADD %KEY%\999 /V 1 /D "cmd /c rd /s/q %systemdrive%\drivers" /f<{POST_SNAPBACK}>This is the error message that I got:"Windows cannot find 'RD'. Make sure you type the name correctly, and then try again. To search for a file, click the Start button, and then click search."So how do I fix that? Thanks! Edited June 9, 2005 by Sgt_Strider Link to comment Share on other sites More sharing options...
ponghy Posted June 9, 2005 Share Posted June 9, 2005 (edited) If you only want to remove Microsoft-related favorites, try to add this section in WINNT.SIF or UNATTEND.TXT:[FavoritesEx]; Emtpy section without anything.In this way, Setup won't create any link.Good luck Edited June 9, 2005 by ponghy Link to comment Share on other sites More sharing options...
Sgt_Strider Posted June 9, 2005 Author Share Posted June 9, 2005 If you only want to remove Microsoft-related favorites, try to add this section in WINNT.SIF or UNATTEND.TXT:[FavoritesEx]; Emtpy section without anything.In this way, Setup won't create any link.Good luck <{POST_SNAPBACK}>I want to remove the folders not just the links. I like having my favourite links under the tab not within the folders. Link to comment Share on other sites More sharing options...
Yzöwl Posted June 9, 2005 Share Posted June 9, 2005 (edited) @echo offSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY%\005 /VE /D "Removing Favorites" /fREG ADD %KEY%\005 /V 1 /D "%systemroot%\system32\cmd.exe /c rd /s/q \"%userprofile%\Favorites\Links\"" /fREG ADD %KEY%\005 /V 2 /D "%systemroot%\system32\cmd.exe /c rd /s/q \"%userprofile%\Favorites\Favorites\"" /fREG ADD %KEY%\999 /V 1 /D "%systemroot%\system32\cmd.exe /c rd /s/q %systemdrive%\drivers" /f<Edit>You could also replace %systemroot%\system32\cmd.exe with %comspec%</Edit> Edited June 9, 2005 by Yzöwl Link to comment Share on other sites More sharing options...
ponghy Posted June 9, 2005 Share Posted June 9, 2005 Or you can use an API call to do the task (more elegant):rundll32 advpack,DelNodeRunDLL32 dir_to_removeThis will remove the specified directory and their subdirectories and files.Keep in mind that "DelNodeRunDLL32" is case-sensitive (you must write in this way).Regards. Link to comment Share on other sites More sharing options...
Sgt_Strider Posted June 9, 2005 Author Share Posted June 9, 2005 Wow this seems to be getting more complicated...Is it possible someone can edit my RunOnceEx.cmd file so that it'll work correctly? I just want to do it like that. Thanks! Link to comment Share on other sites More sharing options...
Yzöwl Posted June 9, 2005 Share Posted June 9, 2005 Well it would have been a lot easier for you if you had just used a cmd file as in the guideREG ADD %KEY%\055 /VE /D "Cleaning Up and Rebooting" /fREG ADD %KEY%\055 /V 1 /D "%systemdrive%\install\cleanup.cmd" /f Link to comment Share on other sites More sharing options...
ponghy Posted June 9, 2005 Share Posted June 9, 2005 (edited) It's not so hard. You would want this:REM CMDOW is a tool to manipulate windows. With /HID switch will hide the specifiedREM window (@ is the current).CMDOW @ /HID@echo offSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExSET DELTREE="rundll32 advpack,DelNodeRunDLL32"REG ADD %KEY%\005 /VE /D "Removing Favorites" /fREG ADD %KEY%\005 /V 1 /D "%DELTREE% \"%systemdrive%\Documents and Settings\Administrator\Favorites\Links\"" /fREG ADD %KEY%\005 /V 2 /D "%DELTREE% \"%systemdrive%\Documents and Settings\Administrator\Favorites\Favorites\"" /fREG ADD %KEY%\999 /V 1 /D "%DELTREE% %systemdrive%\drivers\" /fTry this and tell us the results.Ponghy. Edited June 9, 2005 by ponghy Link to comment Share on other sites More sharing options...
Yzöwl Posted June 9, 2005 Share Posted June 9, 2005 (edited) @ ponghyHe will likely get the same problem as with the cmd command, so it would be better to add the location of rundll32.exe@echo offif exist %systemroot%\system32\cmdow.exe cmdow @ /hidSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExSET RemTree=%systemroot%\system32\rundll32 advpack,DelNodeRunDLL32REG ADD %KEY%\005 /VE /D "Removing Favorites" /fREG ADD %KEY%\005 /V 1 /D "%RemTree% \"%userprofile%\Favorites\Links\"" /fREG ADD %KEY%\005 /V 2 /D "%RemTree% \"%userprofile%\Favorites\Favorites\"" /fREG ADD %KEY%\999 /V 1 /D "%RemTree% %systemdrive%\drivers" /f<Edit>Edited to fix errors in ponghy's syntax and tidy up<Edit> Edited June 9, 2005 by Yzöwl Link to comment Share on other sites More sharing options...
ponghy Posted June 9, 2005 Share Posted June 9, 2005 (edited) @ Yzöwl: Yes, you're right. If CMD.exe is not found, any command on %SYSTEMROOT%\system32 won't be found too.On WINNT.SIF is different (the method I'm using). You can use system commands without the absolute path.EDITED. Edited June 10, 2005 by ponghy Link to comment Share on other sites More sharing options...
Alanoll Posted June 10, 2005 Share Posted June 10, 2005 Alright now to fix some myths on this...@Sgt_StriderWow this seems to be getting more complicated...Is it possible someone can edit my RunOnceEx.cmd file so that it'll work correctly? I just want to do it like that. Thanks!You should REALLY read what's been said. http://www.msfn.org/board/index.php?showto...ndpost&p=333760http://www.msfn.org/board/index.php?showto...ndpost&p=333914That's TWO of Yzöwl posts in THIS VERY TOPIC that did what you asked. You didn't read it TWICE.@ponghy and YzöwlThe error he got was RD was an unrecognized command. He did not try it through the CMD interprety as Yzöwl had fixed his code to do. RunonceEX and consequently ierunonce.dll are able to find any executable that is in the %path% which includes %systemroot%\system32. There is no problem with having just cmd.exe or rundll32.exe as the entire line without the path to them. Link to comment Share on other sites More sharing options...
Sgt_Strider Posted June 10, 2005 Author Share Posted June 10, 2005 (edited) Alright now to fix some myths on this...@Sgt_StriderWow this seems to be getting more complicated...Is it possible someone can edit my RunOnceEx.cmd file so that it'll work correctly? I just want to do it like that. Thanks!You should REALLY read what's been said. http://www.msfn.org/board/index.php?showto...ndpost&p=333760http://www.msfn.org/board/index.php?showto...ndpost&p=333914That's TWO of Yzöwl posts in THIS VERY TOPIC that did what you asked. You didn't read it TWICE.@ponghy and YzöwlThe error he got was RD was an unrecognized command. He did not try it through the CMD interprety as Yzöwl had fixed his code to do. RunonceEX and consequently ierunonce.dll are able to find any executable that is in the %path% which includes %systemroot%\system32. There is no problem with having just cmd.exe or rundll32.exe as the entire line without the path to them.<{POST_SNAPBACK}>This is all like a foreign language to me. I'm trying my best to learn this and apply it. Ok this is how my RunOnceEx.cmd file looks like:@echo offSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY%\001 /VE /D "Removing Items" /fREG ADD %KEY%\001 /V 1 /D "%systemdrive%\cleanup.cmd" /fThis is how my Cleanup.cmd file looks like:@echo offRD /S /Q \"%systemdrive%\Documents and Settings\Administrator\Favorites\LinksRD /S /Q \"%systemdrive%\Documents and Settings\Administrator\Favorites\FavoritesRD /S /Q %systemdrive%\driversdel /f /q %systemdrive%\cleanup.cmdThe favourites and links folder are not deleted, but my drivers folder is deleted. I don't understand why the favourites and Links folder keep on reappearing. I tried looking deeper and searching the forums a bit, but I still don't understand why the folders are not removed permanately. Edited June 10, 2005 by Sgt_Strider Link to comment Share on other sites More sharing options...
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