Picture of Advance Batch Files
Ok, lets get some things straight.   1st: batch files ARE NOT PROGRAMS, they are scripts. 2nd:  batch scripts were made to automate window's functions, NOT to make super awesome 1337h4x0r t00ls.  If you want to learn how to make REAL programs, i suggest you learn C++, C#, JAVA, ASM, or Visual Basic.  3rd:  STOP USING THE .bat FILE ENDING!  USE THE .cmd FILE ENDING.  here is why:  .bat uses COMMAND.com, which was made for DOS and Windows 9x.  .cmd uses CMD.exe, which is basically just a new version of COMMAND.com, and was made for Windows 2k - Windows 7.  COMMAND.com is 16-bit, and CMD.exe is 32-bit, do your math.  Also, .cmd has all the features of .bat, and more.  here are some things that .cmd's have that .bat's dont:
1. you can use longer filenames
2. you can use directory stacks (PUSHD/POPD)
3. better use of arithmetic and integers
4. and alot more command that i don't feel like getting into, i can fill a whole page with reasons to use .cmd instead of .bat.
the only drawback is that .cmd's wont run on really old systems.

TL;DR:  NOBODY uses the command.com anymore, get good habits and use cmd.exe

Ohhh, and lastly, stop using notepad, it sucks.  Get a real editor, i use SciTE, it has syntax for a ton of programming languages.  another good editor is notepad++.
lemonie5 years ago
I like your introduction, it's not often that a person thinks to introduce an Instructable like this.
What are those temp files you're supposed to delete every week or so?

feelsgoodman (author)  lemonie5 years ago
 the temp files are in C://Windows/Temp, their ending is .tmp, they're files that programs create for temporary use.  Some programs delete their temps themselves when you shut them down, some don't.  if you run the Disk cleanup, it should get rid of these also.  But they build up over time, taking up disk space, and malicious files sometimes hide there. 
 Here is where batch comes in!
del *.tmp will get rid of them If only i can do this to cookies...
no... you would delete all .tmp, and thats not the purpose of deleting them. You may would get problems with some programms...
Also its just for deleting them in C:/windows/temp (not on all systems, sometimes its hidden in the userfolder ^-^)
Considering the size of my disks, it's video that hogs my space, but I've still got plenty. I get what these are now, it's nice to be tidy, thanks.

feelsgoodman (author)  lemonie5 years ago
 no prob
Arbitror4 years ago
I have to protest about the .bat/.cmd differences. In widows 7 and Vista (not sure about XP), both .bat and .cmd files are executed through CMD.exe, and both have the same limitations. Pushd/Popd commands work both with .bat and .cmd. Also, 64bit PCs can not emulate 16bit programs, which is why COMMAND.com is no longer bring used. Your info may be true on XP, as it does use both COMMAND.exe, AUTOEXEC.bat and CMD.exe, but I see you're using Vista...

        I really want to see your whole page with reasons to use .cmd instead of .bat!
Also XP. You had to install command.com, but that would be stupid...
Windows has not any command.com since win2k...
but I see you're using Vista...
Never mind, I see you're using 7.

Also as lemonie said, I love your intro!
Dark-player3 years ago
nothing for bad, but i use .bat. It works on everything and works nice...
I tried to play around with the inegers but it doesn't work better!? I also can use longer filenames and pushd/popd. If you got command.com installed (on win2k and up), that would be stupid. .cmd AND .bat USE THE SAME PROGRAMM: CMD.exe. Thats probably stupid what you are writing...
dedric4443 years ago
i have saved this on a usb flash drive. how do i create a path to my files on it?
JenniC5 years ago

Nice instructions. I was looking for something to delete files from /windows/temp that have not been in use for more than 30 days. I ended up writing this script in biterscripting.

# Script DeleteTemp.txt
var str list, file
lf -r -n "*" "/windows/temp" ($fatime < addtime(diff("-30000000"))) > $list
while ($list <> "")
    lex "1" $list > $file
    system delete ("\""+$file+"\"")

Feel free to use this script. In case you want to change it, the documentation for lf, addtime, etc. are at http://www.biterscripting.com .