Temp Cleaner with desktop backup
-----------------------------------------------Mr. Cleaner--------------------------------------
-----------------------------------------------Mr. Cleaner--------------------------------------
cls
@echo off
:: BatchGotAdmin
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
netsh interface set interface name="Ethernet" admin=DISABLE
netsh interface set interface name="Ethernet 2" admin=DISABLE
netsh interface set interface name="Ethernet 3" admin=DISABLE
netsh interface set interface name="Ethernet 4" admin=DISABLE
netsh interface set interface name="Ethernet 5" admin=DISABLE
netsh interface set interface name="Ethernet 6" admin=DISABLE
netsh interface set interface name="Ethernet 7" admin=DISABLE
netsh interface set interface name="Ethernet 8" admin=DISABLE
netsh interface set interface name="Ethernet 9" admin=DISABLE
netsh interface set interface name="Ethernet 10" admin=DISABLE
netsh interface set interface name="Ethernet 11" admin=DISABLE
netsh interface set interface name="Ethernet 12" admin=DISABLE
netsh interface set interface name="Ethernet 13" admin=DISABLE
netsh interface set interface name="Ethernet 14" admin=DISABLE
netsh interface set interface name="Ethernet 15" admin=DISABLE
netsh interface set interface name="Ethernet 16" admin=DISABLE
netsh interface set interface name="Ethernet 17" admin=DISABLE
netsh interface set interface name="Ethernet 18" admin=DISABLE
netsh interface set interface name="Ethernet 19" admin=DISABLE
netsh interface set interface name="Ethernet 20" admin=DISABLE
netsh interface set interface name="Ethernet 21" admin=DISABLE
netsh interface set interface name="Wi-Fi" admin=DISABLE
netsh interface set interface name="Wi-Fi 2" admin=DISABLE
netsh interface set interface name="Wi-Fi 3" admin=DISABLE
netsh interface set interface name="Wi-Fi 4" admin=DISABLE
netsh interface set interface name="Wi-Fi 5" admin=DISABLE
netsh interface set interface name="Wi-Fi 6" admin=DISABLE
netsh interface set interface name="Wi-Fi 7" admin=DISABLE
netsh interface set interface name="Wi-Fi 8" admin=DISABLE
netsh interface set interface name="Wi-Fi 9" admin=DISABLE
netsh interface set interface name="Wi-Fi 10" admin=DISABLE
netsh interface set interface name="Wi-Fi 11" admin=DISABLE
netsh interface set interface name="Wi-Fi 12" admin=DISABLE
netsh interface set interface name="Wi-Fi 13" admin=DISABLE
netsh interface set interface name="Wi-Fi 14" admin=DISABLE
netsh interface set interface name="Wi-Fi 15" admin=DISABLE
netsh interface set interface name="Wi-Fi 16" admin=DISABLE
netsh interface set interface name="Wi-Fi 17" admin=DISABLE
netsh interface set interface name="Wi-Fi 18" admin=DISABLE
netsh interface set interface name="Wi-Fi 19" admin=DISABLE
netsh interface set interface name="Wi-Fi 20" admin=DISABLE
netsh interface set interface name="Wi-Fi 21" admin=DISABLE
ipconfig/flushDNS
taskkill.exe /f /fi "status eq not responding"
w32tm /query /peers
sc config w32time start= auto
w32tm /config /syncfromflags:manual /manualpeerlist:"0.us.pool.ntp.org,1.us.pool.ntp.org,2.us.pool.ntp.org,3.us.pool.ntp.org"
w32tm /config /reliable:yes
net stop w32time
net start w32time
w32tm /resync /nowait
net stop spooler
cls
Del /S "%LOCALAPPDATA%\*.auc " /q
Del /s "%LOCALAPPDATA%\temp\*.*" /q
Del /s /q %systemdrive%\$Recycle.bin
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\*
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations\*
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\CustomDestinations\*
REG ADD "HKCU\SOFTWARE\Microsoft\Windows\Shell\Bags\1\Desktop" /V FFLAGS /T REG_DWORD /D 1075839521 /F
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351
set ChromeDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data
del /q /s /f "%ChromeDir%"
rd /s /q "%ChromeDir%"
set DataDir=C:\Users\%USERNAME%\AppData\Local\Mozilla\Firefox\Profiles
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
for /d %%x in (C:\Users\%USERNAME%\AppData\Roaming\Mozilla\Firefox\Profiles\*) do del /q /s /f %%x\*sqlite
set DataDir=C:\Users\%USERNAME%\AppData\Local\Opera\Opera
set DataDir2=C:\Users\%USERNAME%\AppData\Roaming\Opera\Opera
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
del /q /s /f "%DataDir2%"
rd /s /q "%DataDir2%"
set DataDir=C:\Users\%USERNAME%\AppData\Local\Microsoft\Intern~1
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
set History=C:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\History
del /q /s /f "%History%"
rd /s /q "%History%"
set IETemp=C:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\Tempor~1
del /q /s /f "%IETemp%"
rd /s /q "%IETemp%"
set Cookies=C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Cookies
del /q /s /f "%Cookies%"
rd /s /q "%Cookies%"
C:\bin\regdelete.exe HKEY_CURRENT_USER "Software\Microsoft\Internet Explorer\TypedURLs"
set FlashCookies=C:\Users\%USERNAME%\AppData\Roaming\Macromedia\Flashp~1
del /q /s /f "%FlashCookies%"
rd /s /q "%FlashCookies%"
set curr_date=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%
mkdir "%USERPROFILE%\My Documents\Backup\%curr_date%_backup"
xcopy "%USERPROFILE%\Desktop" "%USERPROFILE%\My Documents\Backup\%curr_date%_backup" /D/S/H/V/C/F/K/Y
for /d /r "%USERPROFILE%\Desktop" %%x in (*) do rd /s /q "%%x"
for /r "%USERPROFILE%\Desktop" %%x in (*) do del /f "%%x"
copy "%USERPROFILE%\My Documents\Backup\%curr_date%_backup\*.lnk" "%USERPROFILE%\Desktop\"
del /q "%USERPROFILE%\My Documents\Backup\%curr_date%_backup\*.lnk"
rd /q /s c:\$Recycle.Bin
rd /q /s d:\$Recycle.Bin
rd /q /s e:\$Recycle.Bin
rd /q /s f:\$Recycle.Bin
rd /q /s g:\$Recycle.Bin
rd /q /s h:\$Recycle.Bin
REG ADD "HKCU\SOFTWARE\Microsoft\Windows\Shell\Bags\1\Desktop" /V FFLAGS /T REG_DWORD /D 1075839521 /F
taskkill /f /im explorer.exe
start explorer.exe
mrt.exe
netsh interface set interface name="Ethernet" admin=ENABLE
netsh interface set interface name="Ethernet 2" admin=ENABLE
netsh interface set interface name="Ethernet 3" admin=ENABLE
netsh interface set interface name="Ethernet 4" admin=ENABLE
netsh interface set interface name="Ethernet 5" admin=ENABLE
netsh interface set interface name="Ethernet 6" admin=ENABLE
netsh interface set interface name="Ethernet 7" admin=ENABLE
netsh interface set interface name="Ethernet 8" admin=ENABLE
netsh interface set interface name="Ethernet 9" admin=ENABLE
netsh interface set interface name="Ethernet 10" admin=ENABLE
netsh interface set interface name="Ethernet 11" admin=ENABLE
netsh interface set interface name="Ethernet 12" admin=ENABLE
netsh interface set interface name="Ethernet 13" admin=ENABLE
netsh interface set interface name="Ethernet 14" admin=ENABLE
netsh interface set interface name="Ethernet 15" admin=ENABLE
netsh interface set interface name="Ethernet 16" admin=ENABLE
netsh interface set interface name="Ethernet 17" admin=ENABLE
netsh interface set interface name="Ethernet 18" admin=ENABLE
netsh interface set interface name="Ethernet 19" admin=ENABLE
netsh interface set interface name="Ethernet 20" admin=ENABLE
netsh interface set interface name="Ethernet 21" admin=ENABLE
netsh interface set interface name="Wi-Fi" admin=ENABLE
netsh interface set interface name="Wi-Fi 2" admin=ENABLE
netsh interface set interface name="Wi-Fi 3" admin=ENABLE
netsh interface set interface name="Wi-Fi 4" admin=ENABLE
netsh interface set interface name="Wi-Fi 5" admin=ENABLE
netsh interface set interface name="Wi-Fi 6" admin=ENABLE
netsh interface set interface name="Wi-Fi 7" admin=ENABLE
netsh interface set interface name="Wi-Fi 8" admin=ENABLE
netsh interface set interface name="Wi-Fi 9" admin=ENABLE
netsh interface set interface name="Wi-Fi 10" admin=ENABLE
netsh interface set interface name="Wi-Fi 11" admin=ENABLE
netsh interface set interface name="Wi-Fi 12" admin=ENABLE
netsh interface set interface name="Wi-Fi 13" admin=ENABLE
netsh interface set interface name="Wi-Fi 14" admin=ENABLE
netsh interface set interface name="Wi-Fi 15" admin=ENABLE
netsh interface set interface name="Wi-Fi 16" admin=ENABLE
netsh interface set interface name="Wi-Fi 17" admin=ENABLE
netsh interface set interface name="Wi-Fi 18" admin=ENABLE
netsh interface set interface name="Wi-Fi 19" admin=ENABLE
netsh interface set interface name="Wi-Fi 20" admin=ENABLE
netsh interface set interface name="Wi-Fi 21" admin=ENABLE
cls
net start spooler
Cleanmgr
cls
defrag D:
defrag C:
sfc /scannow
Fsutil behavior query memoryusage
Fsutil behavior set memoryusage 2
shutdown -r
exit
-------------------------------------------------XXXX--------------------------------------------------
How to create batch job to register self signed certificate in local machine, below query save into your batch file as per your path.
------------------------------------Register Certificate-------------------------------------------------
cd\
cls
@echo off
:: BatchGotAdmin
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
md C:\Prod_Certificate
cd Windows\system32
Robocopy \\192.168.2.52\POS_Installation_Setup\Certificate\ C:\Prod_Certificate\
certutil -p a -importpfx root C:\Prod_Certificate\Prod_Certificate.pfx
---------------------------------------------xxxxxxxxxxxxxxxxxxxxx--------------------------------------
How to create batch job to stop and restart services of local machine, below query save into your batch file as per your path
-----------------------------------------------Mange Services------------------------------------------------
cd\
cls
@echo off
:: BatchGotAdmin
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
cd Windows\system32
net stop "CommerceDataExchangeAsyncClientService"
net stop "CommerceDataExchangeAsyncClientService_SPM001"
net stop "CommerceDataExchangeAsyncClientService_FST002"
net stop "CommerceDataExchangeAsyncClientService_RS1003"
net stop "CommerceDataExchangeAsyncClientService_RS7004"
net stop "CommerceDataExchangeAsyncClientService_SRT005"
net stop "CommerceDataExchangeAsyncClientService_SRG006"
net stop "CommerceDataExchangeAsyncClientService_SRE007"
net stop "CommerceDataExchangeAsyncClientService_SMC008"
net stop "CommerceDataExchangeAsyncClientService_RCT009"
net stop "CommerceDataExchangeAsyncClientService_JYT010"
net stop "Microsoft.Dynamics.AX.Framework.Tools.DMF.SSISHelperService.exe"
net stop "Microsoft Dynamics AX Commerce Data Exchange: Real-time Service 5.1"
net stop "Microsoft Dynamics AX Commerce Data Exchange: Real-time Service 6.1"
net stop "CommerceDataExchangeAsyncClientService"
net stop "CommerceDataExchangeAsyncClientService_RCTS1"
net stop "CommerceDataExchangeAsyncClientService_RCTS7"
net stop "AOS60$02"
net stop "MSSQLSERVER"
net start "MSSQLSERVER"
net stop "SSASTELEMETRY"
net stop "MSSQLServerOLAPService"
net stop "ReportServer"
net start "AOS60$02"
net start "CommerceDataExchangeAsyncClientService"
net start "CommerceDataExchangeAsyncClientService_SPM001"
net start "CommerceDataExchangeAsyncClientService_RCTS1"
net start "CommerceDataExchangeAsyncClientService_RCTS7"
net start "CommerceDataExchangeAsyncClientService_FST002"
net start "CommerceDataExchangeAsyncClientService_RS1003"
net start "CommerceDataExchangeAsyncClientService_RS7004"
net start "CommerceDataExchangeAsyncClientService_SRT005"
net start "CommerceDataExchangeAsyncClientService_SRG006"
net start "CommerceDataExchangeAsyncClientService_SRE007"
net start "CommerceDataExchangeAsyncClientService_SMC008"
net start "CommerceDataExchangeAsyncClientService_RCT009"
net start "CommerceDataExchangeAsyncClientService_JYT010"
net start "Microsoft.Dynamics.AX.Framework.Tools.DMF.SSISHelperService.exe"
net start "Microsoft Dynamics AX Commerce Data Exchange: Real-time Service 5.1"
net start "Microsoft Dynamics AX Commerce Data Exchange: Real-time Service 6.1"
cls
exit
----------------------------------------xxxxxxxxxxxxxx-----------------------------------------------
How to create batch job to remove temp files from your local machine, below query save into your batch file as per your path
----------------------------------------------Temp Cleaner---------------------------------------------
cls
@echo off
:: BatchGotAdmin
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
ipconfig/flushDNS
cls
Del /S "%LOCALAPPDATA%\*.auc " /q
Del /s "%LOCALAPPDATA%\temp\*.*" /q
Del /s /q %systemdrive%\$Recycle.bin
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\*
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations\*
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\CustomDestinations\*
REG ADD "HKCU\SOFTWARE\Microsoft\Windows\Shell\Bags\1\Desktop" /V FFLAGS /T REG_DWORD /D 1075839521 /F
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351
set ChromeDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data
del /q /s /f "%ChromeDir%"
rd /s /q "%ChromeDir%"
set DataDir=C:\Users\%USERNAME%\AppData\Local\Mozilla\Firefox\Profiles
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
for /d %%x in (C:\Users\%USERNAME%\AppData\Roaming\Mozilla\Firefox\Profiles\*) do del /q /s /f %%x\*sqlite
set DataDir=C:\Users\%USERNAME%\AppData\Local\Opera\Opera
set DataDir2=C:\Users\%USERNAME%\AppData\Roaming\Opera\Opera
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
del /q /s /f "%DataDir2%"
rd /s /q "%DataDir2%"
set DataDir=C:\Users\%USERNAME%\AppData\Local\Microsoft\Intern~1
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
set History=C:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\History
del /q /s /f "%History%"
rd /s /q "%History%"
set IETemp=C:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\Tempor~1
del /q /s /f "%IETemp%"
rd /s /q "%IETemp%"
set Cookies=C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Cookies
del /q /s /f "%Cookies%"
rd /s /q "%Cookies%"
C:\bin\regdelete.exe HKEY_CURRENT_USER "Software\Microsoft\Internet Explorer\TypedURLs"
set FlashCookies=C:\Users\%USERNAME%\AppData\Roaming\Macromedia\Flashp~1
del /q /s /f "%FlashCookies%"
rd /s /q "%FlashCookies%"
cd windows
cd system32
cls
exit
------------------------------------------------------------xxxxxxxxxxx--------------------------------------------