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.

Empty %temp% -path, how?

Featured Replies

The code I gave was more a step by step, learning thing, especially with the @echo additions to prevent accidental deletions.

I do not know when the questioner actually Edited their post either, otherwise I would have added this also

for /f "tokens=*" %A in ('dir /b/s/a:d "%Temp%"') do @echo rd /s/q "%~A"

That will also remove all the directories within your temp folder, without removing the Temp itself

<Edit>

Yes you are correct jehuu_za that does delete the %Temp% directory too!

</Edit>

Edited by Yzöwl


Ok I found out "rd %temp%\. /q/s" on some windows xp it deletes %temp%.

to make it work you can fake it out by putting a log file in the location so the directory cannot be deleted.

Try this:

rd %temp%\. /q/s >%temp%\1.log

@ staples

Whilst this is a very good idea, and one which would suffice in most cases, I still think it must be deleting and recreating the %Temp% directory. The reason I say this is that RD does not delete files, therefore the only way for those files to be deleted with that command is for the Temp directory to be removed and then remade for the log file to go inside. You would also of course now not have an empty Temp folder, meaning that in order to achieve the required result you would now have to issue a DEL command on the log file

Another method you could also use within your batch is pushd %Temp%, that'll put you inside the Temp folder, leaving it safe, then issue both the RD and DEL commands, (since as you can see from above, RD doesn't delete files), finally popd.

Incidentally, jehuu_za, why have you not commented on the method I originally gave as a working solution, or the vbs from gunsmokingman?

Here is a tidied version of my original response!

@echo off
for /d %%g in (%temp%\*) do rd /s/q "%%g"
del /f/q/a %temp%\*.*
goto :eof

  • Author
Incidentally, jehuu_za, why have you not commented on the method I originally gave as a working solution, or the vbs from gunsmokingman?

Here is a tidied version of my original response!

Sorry..I forgot to test it ;) But now I have tested it and it works like a charm. Big thanks...I havent tested the .vbs couse the batch works fine.

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.