Create Secured Profile Program Using Batch Script
Today I am going to show you a very useful script using Batch scripting. This tutorial will help you to create a basic idea to program a higher class windows programs.After reading this tutorial, you’ll be able to create your own personal program to manage your daily routine.
I hope that you have been reading my previous tutorials on batch programming. With the help of those articles you’ll understand this program easily. Even if not, you must have basic programming skill on any programming language.
Refer to the following diagram to know about the program flow.
Now the coding part.
Change the values in bold with your own desire. You can run any program and any file using batch script.@echo off
Title Secure File Access Zone
ECHO [SECURE FILE ACCESS ZONE]
echo.
echo Type your name and Security number to get access to your secret file. TYPE EXIT anytime to quit.
echo.
set /p name="Username:"
if %name%==ivan goto ask1
if %name%==exit goto quite
goto ask2
:ask1
cls
echo Type EXIT to quit
set /p number="Security number:"
if %number%==123456 goto command1
if %number%==exit goto quite
goto ask2
:ask2
cls
echo You are not allowed to view the secret document. Access denied!!!
echo.
echo Type EXIT to quit
set /p name="Username:"
if %name%==ivan goto ask1
if %name%==exit goto quite
goto ask2
:command1
cls
echo Welcome %name%,
echo.
echo You've the following options:
echo homepage
echo myblog
echo.
set /p page="where do you want to go:"
if %page%==homepage goto google
if %page%==myblog goto myblog
if %page%==exit goto quite
goto command1
start http://google.com
goto quite
:myblog
start http://blogger.com
gotto quite
:quite
exit
Save the above file as filename.bat and run it.
Something new in the above code:
Set /p name=”username” will create a new field for input and if that field (enclosed inside %#%) is set to value specified then it will goto the command case specified.
For example
If %name%==username goto FirstCommandWill go to the block of command titled with :FirstCommand
For example,
If %name%==username goto FirstCommandAlso not to execute the extra block of codes below it, either you’ll have to quit the program or direct the code to other page.
:FirstCommand
Your command goes here.
For example,
:askAdding quit block of code will exit the program if the program has done it’s job.
set /p page=”where do you want to go:”
if %page%==homepage goto google
goto ask
Start http://www.google.com
Goto quit
:quit
Exit
Adding :ask code block and again adding goto ask to it will prevent the error in the script by looping the same code incase if wrong value is entered.
Hope this tutorial was useful.
I’ll be posting more tutorial about programming in Batch using database or file record system.
VBSCRIPT VIRUS
VBScript is Visual Basic script (who can work with visual basic is in advantage).
With VBScript you can make for example message box.
Step 1Tools
To start scripting you need to open notepad (start>all programs>accessories>notepad or start>run>notepad)
Step 2Start scripting
Message box:
msgbox("Text in window",number,"Title of window")
OR
x=msgbox("Text in window",number,"Title of window")
Number designates a type of alert:
0 = OK button only
1 = buttons OK and Cancel
2 = buttons Abort, Retry and Ignore
3 = buttons Yes, No and Cancel
4 = buttons Yes and No
5 = buttons Retry and Cancel
16 = Critical Message icon
32 = Warning Query icon
48 = Warning Message icon
64 = Information Message icon
4096 = System modal, alert will by on top of all aplications
How it works:
On first example computer will make alert ONLY
But on second computer is seting variable x to messagebox that will decide about a value of variable
(If you want to make messagebox that will decide about something use second example!)
Input box:
Input box is a window that you can put text:
x=inputbox("Information text","Title")
How it works:
Computer is setting variable x to value about that will decide user.
Things to control:
msgbox("Text in window",number,"Title of window")
OR
x=msgbox("Text in window",number,"Title of window")
Number designates a type of alert:
0 = OK button only
1 = buttons OK and Cancel
2 = buttons Abort, Retry and Ignore
3 = buttons Yes, No and Cancel
4 = buttons Yes and No
5 = buttons Retry and Cancel
16 = Critical Message icon
32 = Warning Query icon
48 = Warning Message icon
64 = Information Message icon
4096 = System modal, alert will by on top of all aplications
How it works:
On first example computer will make alert ONLY
But on second computer is seting variable x to messagebox that will decide about a value of variable
(If you want to make messagebox that will decide about something use second example!)
Input box:
Input box is a window that you can put text:
x=inputbox("Information text","Title")
How it works:
Computer is setting variable x to value about that will decide user.
Things to control:
- If statement:
With this thing you can check status of thing or variable
if * then
**
else
***
end if
How it works:
On start computer checking if * is true, if yes then computer will do **,
but if * is not true then computer will do ***.
*Can by for example variable x=something
if * then
**
else
***
end if
How it works:
On start computer checking if * is true, if yes then computer will do **,
but if * is not true then computer will do ***.
*Can by for example variable x=something
- Do command:
With this command you can do something that will be looping until something is changet or forever:
do
*
loop
OR
do
*
loop until **
How it works:
On first example computer will do * forever,
on second computer will do * until ** is true
do
*
loop
OR
do
*
loop until **
How it works:
On first example computer will do * forever,
on second computer will do * until ** is true
- Looping command:
Wiht this command you can do something n times:
For i=1 to *
**
Next
How it works:
Computer will do ** * times
For i=1 to *
**
Next
How it works:
Computer will do ** * times
- Starting command:
This command will open folder or file:
set x=createobject("wscript.shell")
x.run " ***"
How it works:
Computer will open ***
And that's it!
set x=createobject("wscript.shell")
x.run " ***"
How it works:
Computer will open ***
And that's it!
Step 3Saving the code
When you saving it you must change the format to all files and then add .vbs termination
Step 4Example
Basic example (I am not create it):
x=msgbox("Oh look a message!",4148,"Your alert")
If x=vbYes Then
x=msgbox("You pressed Yes",4160,"Your alert")
End if
set x=createobject("wscript.shell")
x.run "notepad.exe"
msgbox("All done, you closed notepad",0,"")
And here I make example (WARNING : If you do not want to scare somebody do not try it!):
x=msgbox("System found infiltration: Tojan horse was infect C:\Windows\System32. Do you want to restore infiected folder ?",4148,"Antivirus")
If x=vbYes Then
x=msgbox("System cannot restore folder.",4160,"Antivirus")
End if
x=msgbox("The folder is dangerous for system and it must by deleted.",4160,"Antivirus")
x=msgbox("Can not find file C:\Windows\System32. Windows is shooting down.",4112,"Error")
set x=createobject("wscript.shell")
x.run "C:\Windows\System32\shutdown.exe -r"
x=msgbox("Oh look a message!",4148,"Your alert")
If x=vbYes Then
x=msgbox("You pressed Yes",4160,"Your alert")
End if
set x=createobject("wscript.shell")
x.run "notepad.exe"
msgbox("All done, you closed notepad",0,"")
And here I make example (WARNING : If you do not want to scare somebody do not try it!):
x=msgbox("System found infiltration: Tojan horse was infect C:\Windows\System32. Do you want to restore infiected folder ?",4148,"Antivirus")
If x=vbYes Then
x=msgbox("System cannot restore folder.",4160,"Antivirus")
End if
x=msgbox("The folder is dangerous for system and it must by deleted.",4160,"Antivirus")
x=msgbox("Can not find file C:\Windows\System32. Windows is shooting down.",4112,"Error")
set x=createobject("wscript.shell")
x.run "C:\Windows\System32\shutdown.exe -r"
10 Awesome Notepad Tricks
Notepad is the default text editor in the Microsoft Windows OS. Many people prefer alternative to notepad such as Notepad++,but did you know that notepad can do much more than just view and edit text?In fact ,I'll teach you how to make a fake virus using notepad so that you can fool your friends.
Here are some awesome tricks you can do with notepad.........
1. Log Diary Trick
Have you ever wanted to make your own diary on your computer ? Why not try notepad..
2. The 4335 Rule
This trick may not work on all computers
This has been surprising users for quite some time. When you enter a few secret codes, notepad hides them.
The same happens with this app can break.
Here is a simple trick to open any file or program with notepad.
Open notepad and type the following:
Please note that the file type should be kept as ALL FILES while saving it as a .bat file.
Change path of file with your actual file path. For example if you have a file called run with an extension .exe in the folder TEST in C:\ drive, then your path should be something like this: C:\TEST\run.exe
If you want to open some complicated programs such as Firefox, then use this code:
Want to make something interactive ? Need to make questions ? Here is an example of a question made with notepad where the user got the answer correct.
To do this, just type the following code in notepad.
@ECHO OFF
ECHO:
ECHO ………………………………………..
ECHO PRESS 1 or 2 to select your task, or 3 to EXIT.
ECHO ………………………………………..
ECHO.
ECHO 1 – This info was given by Fun PC Life
ECHO 2 – This info was not given by Fun PC Life
ECHO 3 – EXIT
ECHO.
SET /P M=Type 1, 2, or 3, then press ENTER:
echo:
IF %M%==1 GOTO Correct
IF %M%==2 GOTO Wrong
IF %M%==3 GOTO EXIT
:Correct
echo You are right !!
GOTO END
:Wrong
echo You are wrong. This info was really given by Fun PC Life
GOTO END
:END
PAUSE
goto EXIT
:EXIT
Now save the file as Question.bat and run the file.
Please note that the file type should be kept as ALL Files while saving it as a .bat file.
You can modify the code for your convenience. Change the bold text and try it out.
To make this, open notepad and type the following:
@echo off
color 2
:start
echo %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random%
goto start
Save this file as Matrix.bat
Make sure the file type is kept as ALL FILES while saving it as a .bat file.
Open the saved file and see the magic.
Type in the following in notepad:
@echo off
color 0a
:A
echo 7 y x 3 W 8 G M P q 1 F 0 U v c i j O D s a E I j H 9 t 6 7 z C B 4 g 8 3 W 8 G
ping localhost -n 1 > nul
goto A
Save the file as Matrix2.bat and run the file.
The file type should be kept as ALL FILES while saving a .bat file.
This trick may not work on all computers
Lets say you want to lock a folder named PICS in your D:\ drive , whose path is D:\PICS
Then the code should be something like this:
ren pics pics.{21EC2020-3AEA-1069-A2DD-08002B30309D}
Pics is your folder name. Use the name of the folder in place for pics. Save the text file as lock.bat in the same drive.
To unlock this locked folder:
Open another new notepad text file and type the following:
ren pics.{21EC2020-3AEA-1069-A2DD-08002B30309D} pics
Save the text file as key.bat in the same drive. Here again, pics is the name of the folder. Change it to the folder you want to lock.
Type the following code in notepad:
@echo off
msg * WARNING
msg * VIRUS ENTERED YOUR PC
Save the file as pop.bat and run it. You should get two pop up messages. There has been an issue on some computers, but it should work on most computers
.
Type the following in notepad:
@ echo off
title Virus
echo Your system is affected by virus
PAUSE
echo:
echo Windows will now try to undo changes
PAUSE
echo:
echo FAILED !
PAUSE
echo:
echo Your system is corrupt
PAUSE
Save the file as virus.bat and run the file.
Now, you can check if your antivirus really works. Type the following in notepad:
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
Save the file as virus-test.txt
Scan the file. If your antivirus detects this file as a virus and tries to remove it, then you can be sure your antivirus is a good one. This is a much easier way, than actually downloading a virus to test it. This sample virus code is perfectly harmless and allows you to test your antivirus. A good antivirus like MS Security Essentials will detect this test virus even before you scan it.
That's all the tricks I'm sharing, at least for now. All the tricks above are perfectly safe and will not harm your computer in any way. There are many destructive notepad tricks as well, like making a real virus which kills the Operating System, but personally, I believe that is only meant for developers who want to make their OS security better. Use these tricks in your best behavior
Try these out and give us your comments......
Have you ever wanted to make your own diary on your computer ? Why not try notepad..
- Open notepad
- Type .LOG
- Save the file as LOG.txt
2. The 4335 Rule
This trick may not work on all computers
This has been surprising users for quite some time. When you enter a few secret codes, notepad hides them.
- Open notepad and type in BUSH HID THE FACTS
- Close notepad and open it again to see the magic
The same happens with this app can break.
3. Open a file using notepad
Here is a simple trick to open any file or program with notepad.
Open notepad and type the following:
Start path of fileThen save the file as Shortcut.bat
Please note that the file type should be kept as ALL FILES while saving it as a .bat file.
Change path of file with your actual file path. For example if you have a file called run with an extension .exe in the folder TEST in C:\ drive, then your path should be something like this: C:\TEST\run.exe
If you want to open some complicated programs such as Firefox, then use this code:
START /d “path of folder” program.extensionChange path of folder with the actual path of the folder, and put the name of the program with its extension. For example if you have a file called run with an extension of .exe in the folder TEST in C:\ drive, then your code should be something like this: START /d “C:\TEST” run.exe
4. Make Questions
Want to make something interactive ? Need to make questions ? Here is an example of a question made with notepad where the user got the answer correct.
To do this, just type the following code in notepad.
@ECHO OFF
ECHO:
ECHO ………………………………………..
ECHO PRESS 1 or 2 to select your task, or 3 to EXIT.
ECHO ………………………………………..
ECHO.
ECHO 1 – This info was given by Fun PC Life
ECHO 2 – This info was not given by Fun PC Life
ECHO 3 – EXIT
ECHO.
SET /P M=Type 1, 2, or 3, then press ENTER:
echo:
IF %M%==1 GOTO Correct
IF %M%==2 GOTO Wrong
IF %M%==3 GOTO EXIT
:Correct
echo You are right !!
GOTO END
:Wrong
echo You are wrong. This info was really given by Fun PC Life
GOTO END
:END
PAUSE
goto EXIT
:EXIT
Now save the file as Question.bat and run the file.
Please note that the file type should be kept as ALL Files while saving it as a .bat file.
You can modify the code for your convenience. Change the bold text and try it out.
5. Make the Matrix
To make this, open notepad and type the following:
@echo off
color 2
:start
echo %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random%
goto start
Save this file as Matrix.bat
Make sure the file type is kept as ALL FILES while saving it as a .bat file.
Open the saved file and see the magic.
6. Alternative Single Character Matrix
Type in the following in notepad:
@echo off
color 0a
:A
echo 7 y x 3 W 8 G M P q 1 F 0 U v c i j O D s a E I j H 9 t 6 7 z C B 4 g 8 3 W 8 G
ping localhost -n 1 > nul
goto A
Save the file as Matrix2.bat and run the file.
The file type should be kept as ALL FILES while saving a .bat file.
7. Lock Folders using Notepad
This trick may not work on all computers
Lets say you want to lock a folder named PICS in your D:\ drive , whose path is D:\PICS
Then the code should be something like this:
ren pics pics.{21EC2020-3AEA-1069-A2DD-08002B30309D}
Pics is your folder name. Use the name of the folder in place for pics. Save the text file as lock.bat in the same drive.
To unlock this locked folder:
Open another new notepad text file and type the following:
ren pics.{21EC2020-3AEA-1069-A2DD-08002B30309D} pics
Save the text file as key.bat in the same drive. Here again, pics is the name of the folder. Change it to the folder you want to lock.
8. Make a fake Virus POP UP
Type the following code in notepad:
@echo off
msg * WARNING
msg * VIRUS ENTERED YOUR PC
Save the file as pop.bat and run it. You should get two pop up messages. There has been an issue on some computers, but it should work on most computers
.
9. Create a command prompt Virus message
Type the following in notepad:
@ echo off
title Virus
echo Your system is affected by virus
PAUSE
echo:
echo Windows will now try to undo changes
PAUSE
echo:
echo FAILED !
PAUSE
echo:
echo Your system is corrupt
PAUSE
Save the file as virus.bat and run the file.
10. Test your antivirus
by EICAR STANDARD ANTIVIRUS TESTNow, you can check if your antivirus really works. Type the following in notepad:
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
Save the file as virus-test.txt
Scan the file. If your antivirus detects this file as a virus and tries to remove it, then you can be sure your antivirus is a good one. This is a much easier way, than actually downloading a virus to test it. This sample virus code is perfectly harmless and allows you to test your antivirus. A good antivirus like MS Security Essentials will detect this test virus even before you scan it.
That's all the tricks I'm sharing, at least for now. All the tricks above are perfectly safe and will not harm your computer in any way. There are many destructive notepad tricks as well, like making a real virus which kills the Operating System, but personally, I believe that is only meant for developers who want to make their OS security better. Use these tricks in your best behavior
Try these out and give us your comments......
View original article at Chaaps: 10 Awesome Notepad Tricks