Showing posts with label batch file tricks. Show all posts
Showing posts with label batch file tricks. Show all posts

Make a Batch File to Clean Ur PC

Hello friends
Can any one pl edit this file for me.
The problem is when i reinstall windows, my id changes from
admin to admin.windows or administrator.whatever
I want %% to be used so that the batchfile can locate the
Windows XP directory and my documents and settings folder.

Any help will be appreciated.


*********************************************
@echo off

if %username% == Administrator.WINDOWS goto admin

REM ** Delete User Files **

rmdir /S/Q "%systemdrive%\Documents and Settings\%username%\Recent"
rmdir /S/Q "%systemdrive%\Documents and Settings\%username%\Local Settings\Temp"
rmdir /S/Q "%systemdrive%\Documents and Settings\%username%\Local Settings\History\History.ie5"
rmdir /S/Q "%systemdrive%\Documents and Settings\%username%\Local Settings\Temporary Internet Files\content.ie5"

goto end



:admin
REM ** Do some extra stuff here **
REM ** What ever you want..... **

ECHO You are a Administrator

rmdir /S/Q "%systemdrive%\Documents and Settings\%username%\Recent"
rmdir /S/Q "%systemdrive%\Documents and Settings\%username%\Local Settings\Temp"
rmdir /S/Q "%systemdrive%\Documents and Settings\%username%\Local Settings\History\History.ie5"
rmdir /S/Q "%systemdrive%\Documents and Settings\%username%\Local Settings\Temporary Internet Files\content.ie5"

REM ** Do more stuff here **
REM ** Blah, blah, blah......**



:end
exit

Write A Batch File To Start Program In Startup

You can start your computer applications automatically and control the sequence of the programs when your computer comes up.

Here we consider you want to run three different applications (WordPad, calculator, and notepad) and minimized automatically with sequence at windows startup. However, you can write a batch file to do the job for you. Open any text editor like notepad and type the following command.

start /min wordpad.exe start /min calc.exe start /min notepad.exe

Now choose the option, Save As to save this file with .bat extension. For example filename.bat.

Now Right- click on Start button and choose open > Double click Programs > here open Startup folder. Now drag your .bat file in the Startup folder and close the dialog box.

Next time When you restart the computer, WordPad, Calc will start first and then Notepad. You won't see the batch file run because you told it to run minimized.
Tricks © 2008-2009.