Jump to content

Recommended Posts

Posted

This is how my RunOnceEx.cmd file looks like:

@echo off

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

REG ADD %KEY%\005 /VE /D "Removing Favorites" /f
REG ADD %KEY%\005 /V 1 /D "RD /S /Q \"%systemdrive%\Documents and Settings\Administrator\Favorites\Links\"" /f
REG ADD %KEY%\005 /V 2 /D "RD /S /Q \"%systemdrive%\Documents and Settings\Administrator\Favorites\Favorites\"" /f

REG ADD %KEY%\999 /V 1 /D "RD /S /Q %systemdrive%\drivers\" /f

I 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!


Posted (edited)

RD is not a recognised command unless run from the command interpreter.

@echo off
SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY%\005 /VE /D "Removing Favorites" /f
REG ADD %KEY%\005 /V 1 /D "cmd /c rd /s/q \"%userprofile%\Favorites\Links\"" /f
REG ADD %KEY%\005 /V 2 /D "cmd /c rd /s/q \"%userprofile%\Favorites\Favorites\"" /f

REG ADD %KEY%\999 /V 1 /D "cmd /c rd /s/q %systemdrive%\drivers" /f

Edited by Yzöwl
Posted (edited)
RD is not a recognised command unless run from the command interpreter.
@echo off
SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY%\005 /VE /D "Removing Favorites" /f
REG ADD %KEY%\005 /V 1 /D "cmd /c rd /s/q \"%userprofile%\Favorites\Links\"" /f
REG ADD %KEY%\005 /V 2 /D "cmd /c rd /s/q \"%userprofile%\Favorites\Favorites\"" /f

REG ADD %KEY%\999 /V 1 /D "cmd /c rd /s/q %systemdrive%\drivers" /f

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 by Sgt_Strider
Posted (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 :hello:

Edited by ponghy
Posted
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 :hello:

I want to remove the folders not just the links. I like having my favourite links under the tab not within the folders.

Posted (edited)

@echo off
SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY%\005 /VE /D "Removing Favorites" /f
REG ADD %KEY%\005 /V 1 /D "%systemroot%\system32\cmd.exe /c rd /s/q \"%userprofile%\Favorites\Links\"" /f
REG ADD %KEY%\005 /V 2 /D "%systemroot%\system32\cmd.exe /c rd /s/q \"%userprofile%\Favorites\Favorites\"" /f

REG 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 by Yzöwl
Posted

Or you can use an API call to do the task (more elegant):

rundll32 advpack,DelNodeRunDLL32 dir_to_remove

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

Posted

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!

Posted

Well it would have been a lot easier for you if you had just used a cmd file as in the guide

  • REG ADD %KEY%\055 /VE /D "Cleaning Up and Rebooting" /f
    REG ADD %KEY%\055 /V 1 /D "%systemdrive%\install\cleanup.cmd" /f

Posted (edited)

It's not so hard. You would want this:

REM CMDOW is a tool to manipulate windows. With /HID switch will hide the specified
REM window (@ is the current).
CMDOW @ /HID
@echo off

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
SET DELTREE="rundll32 advpack,DelNodeRunDLL32"

REG ADD %KEY%\005 /VE /D "Removing Favorites" /f
REG ADD %KEY%\005 /V 1 /D "%DELTREE% \"%systemdrive%\Documents and Settings\Administrator\Favorites\Links\"" /f
REG ADD %KEY%\005 /V 2 /D "%DELTREE% \"%systemdrive%\Documents and Settings\Administrator\Favorites\Favorites\"" /f

REG ADD %KEY%\999 /V 1 /D "%DELTREE% %systemdrive%\drivers\" /f

Try this and tell us the results.

Ponghy.

Edited by ponghy
Posted (edited)

@ ponghy

He will likely get the same problem as with the cmd command, so it would be better to add the location of rundll32.exe

@echo off
if exist %systemroot%\system32\cmdow.exe cmdow @ /hid

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
SET RemTree=%systemroot%\system32\rundll32 advpack,DelNodeRunDLL32

REG ADD %KEY%\005 /VE /D "Removing Favorites" /f
REG ADD %KEY%\005 /V 1 /D "%RemTree% \"%userprofile%\Favorites\Links\"" /f
REG ADD %KEY%\005 /V 2 /D "%RemTree% \"%userprofile%\Favorites\Favorites\"" /f

REG ADD %KEY%\999 /V 1 /D "%RemTree% %systemdrive%\drivers" /f

<Edit>

Edited to fix errors in ponghy's syntax and tidy up

<Edit>

Edited by Yzöwl
Posted (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 by ponghy
Posted

Alright now to fix some myths on this...

@Sgt_Strider

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!

You should REALLY read what's been said.

http://www.msfn.org/board/index.php?showto...ndpost&p=333760

http://www.msfn.org/board/index.php?showto...ndpost&p=333914

That's TWO of Yzöwl posts in THIS VERY TOPIC that did what you asked. You didn't read it TWICE.

@ponghy and Yzöwl

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

Posted (edited)
Alright now to fix some myths on this...

@Sgt_Strider

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!

You should REALLY read what's been said.

http://www.msfn.org/board/index.php?showto...ndpost&p=333760

http://www.msfn.org/board/index.php?showto...ndpost&p=333914

That's TWO of Yzöwl posts in THIS VERY TOPIC that did what you asked. You didn't read it TWICE.

@ponghy and Yzöwl

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

This is all like a foreign language to me. I'm trying my best to learn this and apply it. :whistle:

Ok this is how my RunOnceEx.cmd file looks like:

@echo off

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

REG ADD %KEY%\001 /VE /D "Removing Items" /f
REG ADD %KEY%\001 /V 1 /D "%systemdrive%\cleanup.cmd" /f

This is how my Cleanup.cmd file looks like:

@echo off
RD /S /Q \"%systemdrive%\Documents and Settings\Administrator\Favorites\Links
RD /S /Q \"%systemdrive%\Documents and Settings\Administrator\Favorites\Favorites
RD /S /Q %systemdrive%\drivers
del /f /q %systemdrive%\cleanup.cmd

The 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 by Sgt_Strider

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