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.

Conditional Execution in Batch

Conditional Execution in Batch
Conditional execution means that a command can only be issued under a certain condition. You will also learn in this instructable how to make a single line batch file, and how to organize and categorize a large, confusing batch file.
 
Remove these adsRemove these ads by Signing Up
 

Step 1Do's and Do not's

Do\
Please don't use batch programing if you don't know how to use it, because you can really mess up your computer! I recommend only following this instructible if you are advanced at batch. If your learning batch, or basic at it, you don't really have a need for this.If you have any questions, I suggest learning batch better because this is not hard to understand.
« Previous StepDownload PDFView All StepsNext Step »
18 comments
Jun 8, 2009. 12:21 PMdla888 says:
Hmmm Makes me think of a logic bomb. For those of you who haven't had to deal with viruses carrying this payload, a logic bomb is a set of instructions that are executed when certain variables are met. (i.e. When it reaches december 12 the virus erases your HD)
Oct 13, 2009. 4:12 AMknex_mepalm says:
I'm planning to do something like that, but instead, it sends out a  greeting, i don't know the code for doing this tough.

Refer to Festive Batching for this

Oct 13, 2009. 4:10 AMknex_mepalm says:
I just use this:
@echo off
echo hi would you like to kill your mum Y/N
set/p "kill=>"
if %kill%==Y goto y
if %kill%==y goto y
if %kill%==N goto n
if %kill%==n goto n
:y
echo your mum is dead
:n
echo your mum is dead, not your fault
Jun 15, 2009. 2:18 PMwill421 says:
Hey, Shadow Ops, you can also use the
^
symbol if you don`t want the >, >>, &, && and || to do their thing. For example:
echo hi ^<Html tag^> go ^>> ^& ^> my ^&& and my ^|| and my ^|.
Jun 16, 2009. 7:29 PMwill421 says:
Thanks, I didn`t know that, and I just thought that you should update your Instructable with the info.
May 14, 2009. 5:52 PMhigginsiv says:
hey yall should check out my batches at higginsbatch.webs.com you can download them there, i have a lot of batch games tell me what you think!
Apr 18, 2009. 9:31 AMwill421 says:
I tested the clicky thing (from xdosemu),
and... It worked!
Apr 27, 2009. 9:25 PMwill421 says:
Ohhhhhhhhhh. It says IF (roflol rolling on floor laughing out loud)
Mar 25, 2009. 3:22 PMfwjs28 says:
Mar 25, 2009. 3:58 PMfwjs28 says:
did ya get my script?
Jan 30, 2009. 7:00 PMhigginsiv says:
wow i found something on batches that i didnt know. great job :]
Feb 1, 2009. 8:09 PMSpike002 says:
Lol yah me too, and I thought I knew it all, I use batches all the time but this should help. thanks!
Nov 8, 2008. 8:21 AMflawd1 says:
Thanks for this one! I use a batch file for installing 10-15 programs silently for work, and this will help me keep it a little more organized.
Nov 13, 2008. 2:27 PMspiker says:
very nice, shadow ops rocks!! i will get the PDF for this and use it soon :D thansk again and keep it up

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!
75
Followers
12
Author:Arbitror(Check out my blog!)
One of my favorite hobbies is dismantling electronics, then either combining them together to create something new, or adding components to make them better. I also like gadgets, whether it's taking t...
more »