Batch file to run on Windows STARTUP
So, i have had lot of problem myself with the things that i need to do daily while i open my pc
1) Delete temporary files
2) Ping to check the network status
Sometimes i also need to flush DNS and renew the IP. Hence, i created this batch file
Follow the steps below
1) STARTUP FOLDER - Open the startup folder. Best way to do is
i) Press window button on keypad and R at same time {WIN + R]
This opens the RUN
OR just go to search and type RUN and press enter
ii) Paste the line below and hit enter
%appdata%\microsoft\windows\start menu\programs\startup\
2) right click inside the startup folder and select new then new text document
Double click on it and paste the code below which is at the end of this tutorial
3)Once done, click on File -> save as
Make sure you are inside the Startup Folder
Filename: mybatchfile.bat (or w/e the name you prefer [.bat at the end of the name])
Save as type: Select all Files
Click save
4) Delete the other file that you created 'New Text Document'
{You don't need to do this but oh well i prefer to delete unnecessary files}
5) DONE! Next time you restart your PC, you will not have to go through the trouble :)
*****CODE STARTS FROM HERE *****
@echo off
title DELETING ALL TEMPORARY FILES and MAINTAINING NETWORK
cls
color 1f
echo DELETING TEMPORARY FILES
echo.
REM You need cd to change the working directory of your batch file
cd %temp%
REM You need to delete directories as well:
for /d %%D in (*) do rd /s /q "%%D"
REM You need to skip the question for del and remove read-only files too:
del /f /q *
TIMEOUT /T 5
REM Now, save the file exactly as the path below:
REM %appdata%\microsoft\windows\start menu\programs\startup\cleantemp.bat
REM That will create your batch file and save it inside the Startup folder.
REM Hope it works for you as well ~ pravab@gmail.com
REM SOURCE: http://stackoverflow.com/questions/10716803/batch-file-to-perform-start-run-temp-and-delete-all
REM SOURCE FOR THE SCRIPT BELOW IS IN COMMENT OF THE LINK BELOW FROM anon at 1st april, 2008
cls
color 3e
echo --------------------
echo *** RELEASING IP ***
echo --------------------
ipconfig /release >nul
echo Done!
echo.
echo ------------------------
echo *** RESETTING IP LOG ***
echo ------------------------
@netsh int ip reset C:WindowsTEMPIPRESETLOG.txt >nul
echo Done!
echo.
echo ---------------------------
echo *** FLUSHING ARP TABLES ***
echo ---------------------------
@arp -d >nul
echo Done!
echo.
echo --------------------
echo *** FLUSHING DNS ***
echo --------------------
@ipconfig /flushdns >nul
echo Done!
echo.
echo --------------------
echo *** RENEWING IP ***
echo --------------------
@ipconfig /renew >nul
echo Done!
echo.
TIMEOUT /T 5
echo -----------------------
echo *** Network Status ***
echo -----------------------
ipconfig /all
echo.
TIMEOUT /T 10
cls
color 0f
echo For the source code, email me at ***pravab@gmail.com***
echo.
echo -------------------------------------------------------
echo ### Starting Ping Test ###
echo -------------------------------------------------------
echo.
ping google.com -t
echo.
1) Delete temporary files
2) Ping to check the network status
Sometimes i also need to flush DNS and renew the IP. Hence, i created this batch file
Follow the steps below
1) STARTUP FOLDER - Open the startup folder. Best way to do is
i) Press window button on keypad and R at same time {WIN + R]
This opens the RUN
OR just go to search and type RUN and press enter
ii) Paste the line below and hit enter
%appdata%\microsoft\windows\start menu\programs\startup\
2) right click inside the startup folder and select new then new text document
Double click on it and paste the code below which is at the end of this tutorial
3)Once done, click on File -> save as
Make sure you are inside the Startup Folder
Filename: mybatchfile.bat (or w/e the name you prefer [.bat at the end of the name])
Save as type: Select all Files
Click save
4) Delete the other file that you created 'New Text Document'
{You don't need to do this but oh well i prefer to delete unnecessary files}
5) DONE! Next time you restart your PC, you will not have to go through the trouble :)
*****CODE STARTS FROM HERE *****
@echo off
title DELETING ALL TEMPORARY FILES and MAINTAINING NETWORK
cls
color 1f
echo DELETING TEMPORARY FILES
echo.
REM You need cd to change the working directory of your batch file
cd %temp%
REM You need to delete directories as well:
for /d %%D in (*) do rd /s /q "%%D"
REM You need to skip the question for del and remove read-only files too:
del /f /q *
TIMEOUT /T 5
REM Now, save the file exactly as the path below:
REM %appdata%\microsoft\windows\start menu\programs\startup\cleantemp.bat
REM That will create your batch file and save it inside the Startup folder.
REM Hope it works for you as well ~ pravab@gmail.com
REM SOURCE: http://stackoverflow.com/questions/10716803/batch-file-to-perform-start-run-temp-and-delete-all
REM SOURCE FOR THE SCRIPT BELOW IS IN COMMENT OF THE LINK BELOW FROM anon at 1st april, 2008
cls
color 3e
echo --------------------
echo *** RELEASING IP ***
echo --------------------
ipconfig /release >nul
echo Done!
echo.
echo ------------------------
echo *** RESETTING IP LOG ***
echo ------------------------
@netsh int ip reset C:WindowsTEMPIPRESETLOG.txt >nul
echo Done!
echo.
echo ---------------------------
echo *** FLUSHING ARP TABLES ***
echo ---------------------------
@arp -d >nul
echo Done!
echo.
echo --------------------
echo *** FLUSHING DNS ***
echo --------------------
@ipconfig /flushdns >nul
echo Done!
echo.
echo --------------------
echo *** RENEWING IP ***
echo --------------------
@ipconfig /renew >nul
echo Done!
echo.
TIMEOUT /T 5
echo -----------------------
echo *** Network Status ***
echo -----------------------
ipconfig /all
echo.
TIMEOUT /T 10
cls
color 0f
echo For the source code, email me at ***pravab@gmail.com***
echo.
echo -------------------------------------------------------
echo ### Starting Ping Test ###
echo -------------------------------------------------------
echo.
ping google.com -t
echo.
Comments
Post a Comment