Instructables
Picture of Some Cool Batch Applications
lets get busy.bmp
This is my first instructable so no complaining!
I'd like to thank neodudeman for his instructables, they helped a lot.

In this instructable i will show you some pretty nifty applications with batch commands.

If you have any problems or changes to request just send me an e-mail at jbell@live.co.za
Leave any feedback in the comment section below.
 
Remove these adsRemove these ads by Signing Up

Step 1: Batch Calculator

Picture of Batch Calculator
This is...well... a calculator.
just copy and paste into NOTEPAD and save as calculator.bat
the filename is not important but the extension MUST be saved as " .bat "

@echo off
title Batch Calculator by seJma
color 1f
:top
echo --------------------------------------------------------------
echo Welcome to Batch Calculator by seJma
echo --------------------------------------------------------------
echo.
set /p sum=
set /a ans=%sum%
echo.
echo = %ans%
echo --------------------------------------------------------------
pause
cls
echo Previous Answer: %ans%
goto top
pause
exit

Step 2: Folder Protector

Picture of Folder Protector
This is pretty cool as it requests a password for a folder.
Once you copy it into notepad you must insert your own password and designated folder directory into the designated areas!
NB: THERE ARE TWO PLACES IN WHICH YOU MUST ENTER INFO!!!

@echo off
title Folder Password v1.5
color 0a
set /a tries=3
set password=***ENTER YOUR PASSWORD HERE***
:top
echo.
echo ----------------------------------------------
echo.
echo Folder Password
echo.
echo ----------------------------------------------
echo You have %tries% attempts left.
echo Enter password
echo ----------------------------------------------
set /p pass=
if %pass%==%password% (
goto correct
)
set /a tries=%tries -1
if %tries%==0 (
goto penalty
)
cls
goto top
:penalty
echo Sorry, too many incorrect passwords, initiating shutdown.
start shutdown -s -f -t 35 -c "SHUTDOWN INITIATED"
pause
exit
:correct
cls
echo ----------------------------------------------
echo Password Accepted!
echo.
echo Opening Folder...
echo ----------------------------------------------
explorer ***ENTER FOLDER PATH HERE***
pause

*NOTE: This is not an advanced piece of software, it does not hide or block the destination folder or anything like that so don't get your hopes up.
**Yes, it can now open files with spaces, just use a backslash (\) when typing your filepath.
1-40 of 143Next »
ThomasB94 days ago

I made one that saves your password (the user can choose the password).

tabepic.wix.com/smartcrewhub

TomB61 month ago

Here is a better password protected folder (open it first) you might wanna change the password though, right now look for ENTERPASSWORDHERE:

cls

@ECHO OFF

title Folder Private

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK

if NOT EXIST Private goto MDLOCKER

:CONFIRM

echo Are you sure you want to lock the folder(Y/N)

set/p "cho=>"

if %cho%==Y goto LOCK

if %cho%==y goto LOCK

if %cho%==n goto END

if %cho%==N goto END

echo Invalid choice.

goto CONFIRM

:LOCK

ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

echo Folder locked

goto End

:UNLOCK

echo Enter password to unlock folder

set/p "pass=>"

if NOT %pass%== ENTERPASSWORDHERE goto FAIL

attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private

echo Folder Unlocked successfully

goto End

:FAIL

echo Invalid password

goto end

:MDLOCKER

md Private

echo Private created successfully

goto End

:End

ashuchok11 months ago
Would you please try this? I want to thank you... This code has created by me....
https://www.facebook.com/shuchokbd

@echo off
echo Thank You Very Much...
echo.
echo Please, Press Enter Rapidly!!!
pause>null
echo.
:start
color 0e
pause>null
color 0a
pause>null
color 0d
pause>null
goto start

why the pauses? why not just let it be automatic?

Enter to the folder protector as a password: 1==1 goto correct & if 1

The folder password thing doesn't work, it only blocks like one or two folders.

dos.luke4 months ago

your guys's posts are cool, but for over 1100 lines of code and 50+ added commands, dl at cCMDs-dl.webs.com

drakocasper5 months ago

nice2 smile

lsharma26 months ago

try this code and please open it fullscreen

@echo off

:LOADING

cls

echo Processing.

ping localhost -n 2 >nul

cls

echo Processing..

ping localhost -n 2 >nul

cls

echo Processing...

ping localhost -n 2 >nul

cls

echo Loading....

ping localhost -n 2 >nul

cls

echo Starting.....

ping localhost -n 2 >nul

ping localhost -n 2 >nul

cls

color 0a

echo What do you want to do? Enter your choice

echo 1) Make a matrix falling efect

set/p c=

if %c%==1 goto MATRIX

:MATRIX

cls

echo What colour you want?

echo 1) Green (recommended)

echo 2) Red

echo 3) Blue

echo 4) Purple

set/p ch=

if %ch%==1 goto GREEN

if %ch%==2 goto RED

if %ch%==3 goto BLUE

if %ch%==4 goto PURPLE

:GREEN

color 02

set a=67841350137489528937018256781344

echo %a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%

goto GREEN

:RED

color 04

set a=67841350137489528937018256781344

echo %a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%

goto RED

:BLUE

color 01

set a=67841350137489528937018256781344

echo %a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%

goto BLUE

:PURPLE

color 05

set a=67841350137489528937018256781344

echo %a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%

goto PURPLE

mikey45026 months ago

This is a batch file which makes it look like you have been hacked by anonymous

P.S. shutdown -a is optional

@echo off

color 02

:loop

ping -n 2 127.0.0.1>nul

echo KNOWLEDGE IS FREE!

ping -n 2 127.0.0.1>nul

echo 5

ping -n 2 127.0.0.1>nul

echo 4

ping -n 2 127.0.0.1>nul

echo 3

ping -n 2 127.0.0.1>nul

echo 2

ping -n 2 127.0.0.1>nul

echo 1

ping -n 2 127.0.0.1>nul

color 04

echo !!!!!

color 04

@echo off

:tricks

echo ERROR - PC HAS BEEN HACKED

color 04

Shutdown -R -t 30 -c "We Are Anonymous. We Are Legion. We Do Not Forgive. We Do Not Forget. Expect Us!"

ping 127.0.0.1 -n 7 -w 1000

shutdown -a

pause

Exit

angusPROD2 years ago
its a secure password system that you enter digit by digit
The abort code and password is 1335
Abort code is typed all in one go

***************************
@echo off
title Secure Password
:passeword
Echo password required
set /p CH=
if "%CH%"=="1" goto 1perfect
if not "%CH%"=="1" goto wrong1
:wrong1
Echo wrong
ECho 2 attempts remaining
pause
goto passeword1
:1perfect
Echo Next
set /p QP=
if "%QP%"=="3" goto 3perfect
if not "%QP%"=="3" goto wrong1
:3perfect
Echo next
set /p AD=
If "%AD%"=="3" goto 5perfect
if not "%AD%"=="3" goto wrong1
:5perfect
Echo final one
set /p DM=
if "%DM%"=="5" goto complete
if not "%DM%"=="5" goto wrong1
:passeword1
Echo 2 Attempts remaining
Echo password required
set /p CH=
if "%CH%"=="1" goto 1
if not "%CH%"=="1" goto wrong2
:wrong2
Echo wrong
ECho 1 attempt remaining
Echo Failure to get password
Echo will result in a shutdown
pause
goto passeword2
:1
Echo Next
set /p QP=
if "%QP%"=="3" goto 3
if not "%QP%"=="3" goto wrong2
:3
Echo next
set /p AD=
If "%AD%"=="3" goto 5
if not "%AD%"=="3" goto wrong2
:5
Echo final one
set /p DM=
if "%DM%"=="5" goto complete
if not "%DM%"=="5" goto wrong2
:passeword2
Echo password required
set /p CH=
if "%CH%"=="1" goto 1final
if not "%CH%"=="1" goto wrong3
:wrong3
Echo You have failed to guess the password
ECho You now have 30 seconds to enter the abort code
Echo It is the same as the password
shutdown /s /t 30
Echo **********
set /p SD=
if "%SD%"=="1335" goto abort
if not "%SD%"=="1335" goto end
pause
goto passeword2
:1final
Echo Next
set /p QP=
if "%QP%"=="3" goto 3final
if not "%QP%"=="3" goto wrong3
:3final
Echo next
set /p AD=
If "%AD%"=="3" goto 5final
if not "%AD%"=="3" goto wrong3
:5final
Echo final one
set /p DM=
if "%DM%"=="5" goto complete
if not "%DM%"=="5" goto wrong3
:complete
Echo You made it this far
Echo 1335
Echo Now enter a directory and its ready
Echo made by angusPROD
pause
exit
:abort
shutdown /a
Echo Shutdown aborted
goto passeword2
:end
Echo Goodbye
pause
Exit
HGade angusPROD7 months ago

THIS IS AN EDIT I MADE OF angusPROD.
@echo off

title Secure Password @EDIT BY H.GADE. MAIN CREATOR AngusPROD.

:passeword

cls

echo. NOTE! Code is 1335

Echo Password required

CHOICE /C 123456789 /N >nul

If "%errorlevel%"=="1" (GOTO :1perfect)

If NOT "%errorlevel%"=="1" (GOTO :wrong1)

:1perfect

cls

Echo Next

CHOICE /C 123456789 /N >nul

If "%errorlevel%"=="3" (GOTO :3perfect)

If NOT "%errorlevel%"=="3" (GOTO :wrong1)

:3perfect

cls

Echo Next

CHOICE /C 123456789 /N >nul

If "%errorlevel%"=="3" (GOTO :5perfect)

If NOT "%errorlevel%"=="3" (GOTO :wrong1)

:5perfect

cls

Echo Final Digit

CHOICE /C 123456789 /N >nul

If "%errorlevel%"=="5" (GOTO :complete)

If NOT "%errorlevel%"=="5" (GOTO :wrong1)

:wrong1

Echo. Wrong. You will have to wait 30 seconds.

Echo.

timeout -T 30 /NOBREAK >nul

(GOTO :passeword)

:passeword1

Echo 2 Attempts remaining

Echo password required

set /p CH=

if "%CH%"=="1" goto 1

if not "%CH%"=="1" goto wrong2

:wrong2

Echo wrong

ECho 1 attempt remaining

Echo Failure to get password

Echo will result in a shutdown

pause

goto passeword2

:1

Echo Next

set /p QP=

if "%QP%"=="3" goto 3

if not "%QP%"=="3" goto wrong2

:3

Echo next

set /p AD=

If "%AD%"=="3" goto 5

if not "%AD%"=="3" goto wrong2

:5

Echo final one

set /p DM=

if "%DM%"=="5" goto complete

if not "%DM%"=="5" goto wrong2

:passeword2

Echo password required

set /p CH=

if "%CH%"=="1" goto 1final

if not "%CH%"=="1" goto wrong3

:wrong3

Echo You have failed to guess the password

ECho You now have 30 seconds to enter the abort code.

Echo It is the same as the password

shutdown /s /t 30

Echo **********

set /p SD=

if "%SD%"=="1335" goto abort

if not "%SD%"=="1335" goto end

pause

goto passeword2

:1final

Echo Next

set /p QP=

if "%QP%"=="3" goto 3final

if not "%QP%"=="3" goto wrong3

:3final

Echo next

set /p AD=

If "%AD%"=="3" goto 5final

if not "%AD%"=="3" goto wrong3

:5final

Echo final one

set /p DM=

if "%DM%"=="5" goto complete

if not "%DM%"=="5" goto wrong3

:complete

Echo You made it this far

Echo Now enter a directory and its ready

echo.

echo.

Echo. Made by angusPROD

echo. Edit by H.Gade

echo.

Echo. Editor Above took this batch to a whole new level.

echo. Thank you for Trying out this batch.

echo.

pause >nul

exit

:abort

shutdown /a

Echo Shutdown aborted

goto passeword2

:end

Echo Goodbye

pause

Exit

marmig040411 months ago
I like your version but i have made my own.
anyone can check it out if they want but please give credit when sharing. Thank you!

@echo off
title Calculator
color 0a
echo Welcome to The Basic Arithmetic Calculator
echo Made By Martin Miglio
ping localhost -n 3 >nul

:LOADING
cls
echo Loading.
ping localhost -n 2 >nul
cls
echo Loading..
ping localhost -n 2 >nul
cls
echo Loading...
ping localhost -n 2 >nul
cls
echo Loading....
ping localhost -n 2 >nul
cls
echo Loading.....
ping localhost -n 2 >nul
ping localhost -n 2 >nul
color 0a

:START
cls
echo What Type of Math would you like to do?
echo Add, Subtract, Multiply, or Divide.
set /p math=
IF '%math%' == 'Add' GOTO ADD
IF '%math%' == 'add' GOTO ADD
IF '%math%' == 'Subtract' GOTO SUB
IF '%math%' == 'subtract' GOTO SUB
IF '%math%' == 'Multiply' GOTO MULTIPLY
IF '%math%' == 'multiply' GOTO MULTIPLY
IF '%math%' == 'Divide' GOTO DIVIDE
IF '%math%' == 'divide' GOTO DIVIDE
Exit

:ADD
Cls
GOTO NUMBERSADD
pause
exit

:SUB
Cls
GOTO NUMBERSSUB
pause
exit

:MULTIPLY
Cls
GOTO NUMBERSMULTIPLY
pause
exit

:DIVIDE
Cls
GOTO NUMBERSDIVIDE
pause
exit

:NUMBERSADD
echo What is the First Number you would like to Add?
set /p number1=
cls
echo What is the Second Number you would like to Add?
set /p number2=
cls

GOTO ADD2
exit

:NUMBERSSUB
echo What is the First Number you would like to Subtract?
set /p number1=
cls
echo What is the Second Number you would like to Subtract?
set /p number2=
cls
GOTO SUB2
exit

:NUMBERSMULTIPLY
echo What is the First Number you would like to Multiply?
set /p number1=
cls
echo What is the Second Number you would like to Multiply?
set /p number2=
cls
GOTO MULTIPLY2
exit

:NUMBERSDIVIDE
echo What is the First Number you would like to Divide?
set /p number1=
cls
echo What is the Second Number you would like to Divide?
set /p number2=
cls
GOTO DIVIDE2
exit

:ADD2
Set /A result = %number1% + %number2%
echo The answer is %result%.
Pause
GOTO START
exit

:SUB2
Set /A result = %number1% - %number2%
echo The answer is %result%.
pause
GOTO START
exit

:MULTIPLY2
Set /A result = %number1% * %number2%
echo The answer is %result%.
pause
GOTO START
exit

:DIVIDE2
Set /A result = %number1% / %number2%
echo The answer is %result%.
pause
GOTO START
exit




fin
X_STOP_X1 year ago
this is a folder lock that does hide the folder
cls
@ECHO OFF
title Folder Confidential
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Confidential goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Confidential "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter the Password to unlock folder
set/p "pass=>"
if NOT %pass%== Passwords are hard to crack goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Confidential
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md confidential
echo Confidential created successfully
goto End
:End
@ECHO OFF
title Folder Confidential

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Confidential goto MDLOCKER


:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Confidential "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter the Password to unlock folder
set/p "pass=>"
If %pass%==Password GOTO test
if NOT %pass%==Password goto FAIL
:test
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Confidential
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md confidential
echo Confidential created successfully
goto End
:End

I correct your code
Joe Diffie1 year ago
That's pretty cool stuff!
I'm working on a forum where I need to do just 2 simple math problems.

Var/.4 =x and var/.6=x

I don't know what the rise in the number by .4 and .6 actually really does for the company but that's the way they want it.

does anyone know how to build an easy app for that.
just 3 text boxes. one for entering an amount and an enter button that does the math and enters that data in the .4 and .6 math answers text boxes simultaneously.
They don't even need to be labeled.
KoreusZ1 year ago
How about cluttering the screen with visual basic scripts, that'd look more realistic.
Wookie1231 year ago
Free maintenance batch for Windows, just uses utilities built into windows 7 and 8, with 1-click action. Has an installer though. Cleans, defrags, disk checks, updates, checks for malware...etc. User is free to edit it for personal use, make it better...etc :)

OnceOver Maintenance Batch
www.freeOMB.com
g3lrod1 year ago
Put this in for a nice little password protect:

Set /a try=0

:begin
set /a try=%try%+1
If %try%==4 GOTO die
Echo Enter your password:
Echo.
Set /p pass="-->"

If %pass%==**PASSWORD** GOTO correct
GOTO begin

:die
Echo Too many incorrect tries
rem (Put some form of punishment here)

:correct

rem Your main code
STEDZ1 year ago
@Win7Maniacwhat do you mean by "this sets off the internal alarm in XP and maybe Vista" and what's an"internal alarm"?
g3lrod STEDZ1 year ago
I believe that is the motherboard beeper.
emuman4evr5 years ago
Anyone know the command that saves a list of all the files on a hard drive? I want it to basically save the hdd's file tree as a .txt document with the name of the computer and the date in the filename.
This should work:

TREE C:\ > "Tree.txt"

Then you can either find the file and open it or type in:

START Tree.txt

And then you can either find the file and copy it's contents and then delete it manually OR:

DEL Tree.txt

All of that should work
samkai3 years ago
how do you times, plus, and all that?
The operators in batch scripts are the following:

+ Addition
- Subtration
* Multiplication
/ Division
% Modulus (use %% in batch scripts)
>> and & Bitwise operators
() Grouping
! ~ Unary operators
= *= /= %= += -= &= ^= |= <<= >>= assignment

For more information type "SET /?" in your command prompt.
@Sejma if you want to carry a message through you must first put echo before it or else cmd will recognize it as an automated command input and you will get a crapload of errors. it will say:

"put message here" is not recognized as an internal or external command or a batch file.

just a little warning for the future
Really? Come on? Did you even look at the code?
rockin44592 years ago
I found this nifty batch file that when initially run will create a folder called locker in the same directory as the batch file. put files you want to hide in it and then run the batch file again and it will change it to a control panel shortcut that normally will not be seen unless you have your hidden files unhidden. even then to click it would take you to the control panel. It used to be named Locker.bat, but i renamed it to Systems to deter people from running it. Once you have changed yourpasswordhere to the password you want go get Bat_To_Exe from http://www.f2ko.de/programs.php?lang=en&pid=b2e so that your password can't be discovered. Enjoy

cls
@ECHO OFF
title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto
UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the system (Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo system locked
goto End
:UNLOCK
echo Enter password
set/p "pass=>"
if NOT %pass%==yourpasswordhere goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
echo system Unlocked successfully
goto End
:FAIL
echo Invalid password
goto UNLOCK
:MDLOCKER
md Locker
echo system created successfully
goto End
:End
The .bat to .exe converter on http://www.f2ko.de/programs.php?lang=en&pid=b2e hides trojans in the .exe that it makes!!!

DO NOT USE IT!!
I hear you saying that a lot, what is your proof?
el-xavi262 years ago
Hey I have seen you have a lot of knowledge in batching. Can you please explain how to add points(numbers) to a amount of points
What do you mean by this? Are you asking how to add to a pre-existing variable?
Because you used the term "points" I think you are talking about a game.
That would mean that you must add to a variable if (big hint) a certain condition is met.

So:
IF %win% equ 1 set points=%points%+1


That will make the variable "points" go up by one if the variable win is set to one.

Obviously, I didn't have much to go on, but you can use that as a template if you want.
el-xavi262 years ago
can somebody explain me how to use the set command im really confused
PLEASE ANSWER!!!
The SET command is one of the most complex commands in batch scripting (other than FOR). Basically, there are three main "versions" of it.

Version one: Just the normal "SET" command, by itself.
When the SET command is by itself, it creates a variable with the value of what you set it as originally. 
Example: SET Variable=Value
To call an all ready call an all ready defined variable, enclose it in percent signs.
Example: ECHO %Variable%
This code would return "Value" onto the screen.

 Version two:The A switch.
The A parameter in the SET command stands for "Algorithm". When it is added, you can use math in a variable.
Example: SET /A Addition=1+1
This would set "Addition" to the value of 2, rather than "1+1" if the A switch was left out.
You can also use this with variables.
Example:
SET Number1=5
SET Number2=15
SET /A Number3=%Number2% / %Number3%

This code will set Number3 as 3, because 15 divided by 5 is 3.

Version three:The P switch.
When the P switch is added to the SET command, it allows a variable to be user-defined.
Example: SET /P User_Defined_Variable=Prompt String: 
This would display "Prompt String", and wait until you enter a value.

There are many other ways to use the SET command, but these are just a few.

Enter the code: "SET /?" in your command prompt for more detailed answers.
sda coba2 years ago
This batch should hide the folder and put a password to it. But it doesn't function very well, the folder does hide, but you can put any password and the folder will appear anyway.
What i want to do is to combine the Folder Protector code with the one that hides the folder.. Could someone help me?
I need it so i can hide my games at work haha
Im from Buenos Aires, Argentina

Thanks


Code:

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-0800 2B30309D}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-0800 2B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-0800 2B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%==type your password here goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-0800 2B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-0800 2B30309D}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End


yohi98894 years ago
Hey, here's my edit to the script it changes the number everytime

:R
@echo off
color 0e
title Guessing Game by seJma
set /a guessnum=0
set /a answer=%RANDOM%
set variable1=surf33
echo -------------------------------------------------
echo Welcome to the Guessing Game!
echo.
echo Try and Guess my Number!
echo -------------------------------------------------
echo.
:bottom
echo.
set /a guessnum=0
set /a answer=%RANDOM%
set variable1=surf33
set /p guess=
echo.
if %guess% GTR %answer% ECHO Lower!
if %guess% LSS %answer% ECHO Higher!
if %guess%==%answer% GOTO EQUAL
set /a guessnum=%guessnum% +1
if %guess%==%variable1% ECHO Found the backdoor hey?, the answer is: %answer%
goto bottom
:equal
echo Congratulations, You guessed right!!!
echo.
echo It took you %guessnum% guesses.
echo.
goto R
I have a way better version!
Send it to me in Private Message. I got some pretty good batches as well
jayfin yohi98892 years ago
yohi9889 Your batch file looks good but every time I guess a number it changes.
I typed 9999 and it said lower I typed 9999 again but then it said higher. Is there a way to make it that the numbers don't change until I get it? Can you please email me at jfingerer@ymail.com
electronicz2 years ago
Check out my modified Site Selector. It is a txt file and will have to be saved again as a .bat file.
1-40 of 143Next »