Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

pc restart then run clean up ?

Featured Replies

hi im having trouble using my clean up script to clean off some unwanted desktop icons and rerout my start menu programs,,

the problem is my cleanup script is running before the desktop gets a chance to fully setup so the script runs before everthing is fully set so it has nothing to delete and reroute, then its set to auto matically restart the pc

is there any way i can set the pc to restart after everything is finally set up , then have it in the cmd remember to run the cleanup script after the desktop is setup then delete it self ?

You could entry the files in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager under the REG_EXPAND_SZ value PendingFileRenameOperations. Then the files are deleted after next restart.

Just google for the value name and you'll find enough explanations.

Of course, you also could run a batch through runonceex, but I prefer first method, cause you don't need to call a batch with this.

Edited by Doc Symbiosis

In the first cleanup cmd you copy a batch file into the startup folder of the user that automatically log's on.. the startup folder wil be loaded after the desktop, this is the way i worked around this problem..

Greets!

I'm with AndreK on this one, but with a twist: I place a WinRAR SFX called Finish.exe in the All Users Startup folder ($OEM$\$Docs\All Users\Start Menu\Programs\Startup) that unpacks the .cmd file to the temp directory and runs it from there. The last line of the .cmd deletes the SFX from the Startup directory.

Finish.exe WinRAR SFX Archive comment:

Path=%windir%\Temp

Setup=cleanup.cmd

Silent=1

Overwrite=1

Title=...

cleanup.cmd:
@ECHO OFF

::Clean up Start Menu shortcuts

SET AllStart=%systemdrive%\Documents and Settings\All Users\Start Menu

SET AllDesk=%systemdrive%\Documents and Settings\All Users\Desktop

DEL /F "%AllStart%\Set Program Access and Defaults.lnk"

etc.

DEL "%AllDesk%\WinZip.lnk"

etc.

RD /S /Q "%systemdrive%\blah\blah\blah"

etc.

ECHO Y | Del "%systemdrive%\WINDOWS\*.bmp"

DEL "%systemdrive%\Documents and Settings\All Users\Start Menu\blah.lnk"

etc.

DEL /F "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Startup\Finish.exe"

CLS

EXIT

  • Author
I'm with AndreK on this one, but with a twist: I place a WinRAR SFX called Finish.exe in the All Users Startup folder ($OEM$\$Docs\All Users\Start Menu\Programs\Startup) that unpacks the .cmd file to the temp directory and runs it from there. The last line of the .cmd deletes the SFX from the Startup directory.

Finish.exe WinRAR SFX Archive comment:

Path=%windir%\Temp

Setup=cleanup.cmd

Silent=1

Overwrite=1

Title=...

cleanup.cmd:

@ECHO OFF

::Clean up Start Menu shortcuts

SET AllStart=%systemdrive%\Documents and Settings\All Users\Start Menu

SET AllDesk=%systemdrive%\Documents and Settings\All Users\Desktop

DEL /F "%AllStart%\Set Program Access and Defaults.lnk"

etc.

DEL "%AllDesk%\WinZip.lnk"

etc.

RD /S /Q "%systemdrive%\blah\blah\blah"

etc.

ECHO Y | Del "%systemdrive%\WINDOWS\*.bmp"

DEL "%systemdrive%\Documents and Settings\All Users\Start Menu\blah.lnk"

etc.

DEL /F "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Startup\Finish.exe"

CLS

EXIT

yea blinktd that is what i tried also it works like a charm,, thanks for your advice unfortunatly ,, i thought that one up to the day i wrote this thread :) great minds think alike,

i had been trying to figure out a way to run cleanup propperly also. this method worked great. thanx all

  • 1 month later...

Question though...

Where does the Finish.exe get the .cmd file from in order to extract it to the temp folder?

What are the 3 things at the end of this? Is that what I use or put a title there?

Title=...

Just a quick follow up from me.

Thanx to member Djé for this simple code that makes a batch file delete itself upon finishing.

DEL /Q /F %0

Hope it helps someonelse down the line. If so give the props to Djé. I'm just a 'LiL middle man.

Thanx to member Djé for this simple code that makes a batch file delete itself upon finishing.

DEL /Q /F %0

Almost ;)

You need to include in your batch.

@echo off
SetLocal enableextensions

::Your cleanup code below here


::Your cleanup code above here

del /q "%~f0"

EndLocal

just adding

DEL /Q /F %0

Exit

to the end of my .cmd file worked for me.

I could of just got lucky, but 100% deleted itself. 5 different times or so now too.

Just F.Y.I. because I dang sure can't dispute anyone let alone a 6 star MSFN Expert. :}

  • 1 year later...

Old post to be sure, but I recall putting the .cmd into the WinRAR SFX (.exe format) because it would not run from Startup. Can't recall now . . . sounds like the batch file is all that is needed, thanks.

I create a user, that user logs in automatically, I place cleanup2.bat in the user's start-up folder.

All Users does not work.

laze.

Since this old thread has been resurrected (*I* didn't do it :angel ), I hope someone can explain something to me. I've seen two lines that have been used to delete a currently running cmd file. I understand that DEL /Q /F %0 will DELete the current file (%0 referring to the 0th argument of the original cmd, or the file itself) Quietly (/Q) and Force the deletion even if it's a read-only file (/F).

Then there's DEL /Q "%~f0" which appears to Quietly DELete (something). Obviously, that something is the current cmd file in this case, but how does the "%~f0" get parsed? I can see how "%0" would be better than %0 in case there are spaces in the file name. Is ~f equivelent to /F? Why is it included within the %0 argument? Does the second version do anything different from the first?

I'd like to understand this for general knowledge purposes. I've written thousands of batch files in my life but I've never used the syntax of the second example. DEL /? doesn't even describe it.

Ray

FYI: In case anyone shares my curiosity, I just tested adding quotes to %0 in a simple cmd file. To execute a cmd file with spaces in its name, you already had to enclose the file name in quotation marks ("test this.cmd" as opposed to test this.cmd). %0 already includes the quotation marks and enclosing it in additional quotation marks in the DEL command doesn't work ("%0" expands to ""test this""). So nevermind what I said about "%0" being an improvement over %0. It's not.

Edited by NOTS3W

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.