The Temp files are in user mode, and they won't required administrator or any credential. Standard users would be able to remove it manually. In case you want to require them to add credential, you will have to add scripts to ask for credential and if the login succeed execute this part or change permission in the TEMP folder which is possible but not a good practice and standard users might face multiple access denied messages while working with PC.
Require password prompt on batch file.

Hello Team,
We have below batch file that needs to ask me for administrative credentials. Please make suitable changes.
Remove temporary files from Windows 10 via below batch file which needs to ask anyone Username and Password.
@Echo off
del "%tmp%*." /s /q /f
FOR /d %%p IN ("%tmp%*.") DO rmdir "%%p" /s /q
Windows for business Windows Client for IT Pros User experience Other
3 answers
Sort by: Most helpful
-
Reza-Ameri 17,336 Reputation points Volunteer Moderator
2022-06-11T15:30:09.183+00:00 -
Gurudas 951 Reputation points
2022-06-14T01:26:58.12+00:00 Hello Reza-Ameri,
Greetings!
I am currently working a Powershell script that requires a username and password prompt so that a user with administrative credentials can only execute this batch file via Powershell. However removing temporary files is just an example for your reference. Cheers!
Thank you and have a great day ahead!
-
Gurudas 951 Reputation points
2022-06-15T09:45:43.58+00:00 Hello MotoX80,
I was looking for "Get-Credentials" command for executing above batch file in a test environment. Cheers!