Showing posts with label .bat files. Show all posts
Showing posts with label .bat files. Show all posts

Sunday, 28 August 2011

Batch file program -Simple Integer Calculator

                                                                      
Here you can see a simple code to create calculator using batch file.
Just copy the following code
Paste it in notepad

Save it as any name.bat
Open the newly created batch file.
Cmd will appear.
Put the numbers with operators(Ex : 8 * 9)
Press Enter to get answer.
That's it
CODE 


@echo off
title  Calculator
:1
echo Enter operands with operators(Ex: 5 + 6):
set /p input=
set /a result=%input%
echo Result is: %result%
:2
echo Continue - y , Exit- n
set /p "choice=>"
if %choice%==y goto 1
if %choice%==n goto end
echo Invalid choice
goto 2
:end
exit

Saturday, 13 August 2011

Complete hiding of folders using batch file

STEPS



1: Open a new text file.

2: Copy the codes given  and paste it in the text file, the follow the steps

3: Save it with .bat extension.

4: A  new batch file appears.

5: Open it.

6: You  can see a new folder called locker.

7: Put the files you want to hide into the locker.

8: Double click on the batch file.

cmd will appears.

9: Type the letter y in cmd.

OK hiding completed.

10: To see that file double click the batch file.



11: Give your password in cmd.

That's it .
This is much better than normal way.

 CODE:

cls@ECHO OFFtitle 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 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-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%== PASSWORD goto FAIL

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

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

echo Folder Unlocked successfully

goto End

:FAIL

echo Invalid password

goto end

:MDLOCKER

md Locker

echo Locker created successfully

goto End

:End




Twitter Delicious Facebook Digg Stumbleupon Favorites More