3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Basics of Batch Files

Step 5Creating the Batch File

Creating the Batch File
Ok, so we've covered the basics of the DOS Command window, but how can we create a Batch file?

Well I'm very glad you asked that question, because that is exactly what we're trying to cover!

Batch files are simply Text files with the extension changed to .bat

Really Really easy stuff.

Just open up a text editor, type in your command, and save it as a .bat!

Tada! You've made your first batch file!

So what exactly can you do with this little file?

Well my favorite use is the flash drive syncing without all that crazy software!

Here's the command I use:

XCOPY "E:\" "C:\Documents and Settings\Neo\My Documents\Flash Drive" /S

This will copy all the files out of my flash drive, which is always E:/, including the subfolders, right into My Documents/Flash Drive, thus insuring all of my data is quickly backed up!

Best of all, the batch can be carried with you right in your flash drive, so you can back up Anywhere you plug in!

Pretty dandy eh?

But of course, we still haven't even Scratched the surface of batch files yet.

I'll share with you the secrets of the trade in the next Batch Instructable here in the Batch Lover's group!

~ciao~
« Previous StepDownload PDFView All StepsNext Step »
10 comments
Jul 14, 2009. 8:39 AMDNR says:
hey wen i open any of my drives a "open with" dialogue box opens...what to do to make it open normally
Apr 10, 2010. 9:07 PMGuard13007 says:
You're opening it with:

start "C:/something/"

yes? Something like that? Use:

start "C:/something/" "explorer.exe"

This makes it open with explorer, which is what I assume you meant.
Aug 24, 2009. 6:51 PMj.yeshe108 says:
I'm not sure really but in the list of programs to open the drives with try to find one that says something like "Open files with windows" that has a picture of a folder next to it
Oct 25, 2007. 2:03 AMarnoldtheduck says:
hey man, i can't get my shutdown batch file to run. it sorta flashes 4 a sec and then disappears. can u help me plz?
Dec 16, 2009. 10:45 AMAsk-Away15 says:

TRY THIS ONE INSTEAD! SIMPLE!

@echo off
echo (Your Message - Pull Them Into Pressing Another Button)
pause
echo (Your Message - Pull Them Into Pressing Another Button)
pause
echo (Your Message - Pull Them Into Pressing Another Button)
pause
shutdown -s -t 20 -c "Shutting Down"
:Top
echo (Your Message)
echo (Your Message)
echo (Your Message)
echo (Your Message)
echo (Your Message)
goto Top  

 

After This Is All Initiated, The Shutdown Is Unstopable, unless You Type Shutdown -a Into The CMD That Will Stop The Countdown Thus Stopping The Shutdown :)

By The Way You Dont Have TO Have 20 As The Shutdown Timer.. I Could Be 1 Second But Thats No Fun LOL Always Fun To Watch Them Like... WTF DUDE AHH WTF IS GOING ON.. lol

Dec 16, 2009. 1:19 PMarnoldtheduck says:
hey thanks a lot dude!
Sep 10, 2009. 6:18 PMpinkspeedo says:
no make sure it says shutdown -s -t (time here ) you dont need to pause if your shutting down..
Dec 19, 2007. 11:13 PMmunchman says:
You could add the line pause to the end of the file.
Sep 3, 2007. 10:34 AMknewman says:
Can I put more than one command in a batch file? For instance I'm not sure that every time I plug in my flash drive it will be recognized as the E: drive, could I put the same command in the same batch file with a different letter drive? And will the batch file work if it is hidden?
Sep 17, 2006. 6:19 PMOuch says:
Yea, you could also write an autorun.ini file so everytime you plug your drive in, it automatically syncs.
Sep 17, 2006. 4:52 PMuserman says:
That's cool! You could also use the /D and /Y switches to xcopy, so it will only copy new files and overwrite those who are older than the flash ones. (don't use /Y if you're not really sure the pen drive has the latest files and/or you don't have a backup)

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
22
Followers
5
Author:Neodudeman