Pages

Thursday, 13 June 2013

Cmd Fun Tricks -part 1


1.Blinking CMD



  Make your cmd flash like a light bulb with this simple batch script.
  copy paste and run it.
  enjoy...


@echo off
:a
color 47
goto b
:b
color f6
goto c
:c
color 20
goto d
:d
color 46
goto e
:e
color 20
goto a
 


save it as .bat file.

2.Hey  have you tried matrix in cmd.....falling words ...............





@echo off 
cls
color 02
:a
echo %random% %random% %random% %random% %random% %random%%random% 
echo %random% %random% %random% %random% %random%
echo %random% %random% %random% %random% %random% 
echo %random% %random% %random% %random% %random% %random%
echo %random% %random% %random% %random% %random% %random%
goto a

So i belive you did enjoy the above overall session ...
so we can move to the next level of the batch scripting..........

Color in cmd /batch


Nice again.....
Wanna change foreground color and background color in cmd .
yes you can....
use the command...color

syntax:
color  background-color foreground-color
eg:

@echo off
color 02
color bf





Goto Statement in cmd

Well this is the interesting part  to Fun with cmd part1:
Goto Command redirects the control of execution to other set of statements setting up a "jump of control".

Syntax:
Goto statement
//jumps these codes without executing
:statement
//jumps here executing these codes.


Eg:

@echo off
start notepad
goto a
start cmd
:a
start iexplore
exit
In the above code cmd doesn't open up as the goto statements override the instruction.
I believe it was helpful for you people ..next we are gonna discuss the interesting part It would be about changing foreground and background colors in cmd.

Variables in Batch/Dos cmd




Hello welcome again,
 Hope you are doing well ,if so lets continue.  Today we are going to learn something more interesting about variable.

"What is variable" ??
 "variables are containers that holds values that could be nos,strings,symbols etc..."
Syntax: 
Set variable-name=values
  So , the set command sets the values to the variable in variable container called to be the variable name. 

Eg:
@echo off
Set name=ashlin gabriel
Set age=21

well here how do we display the variable.........????
we have to enclose the variablename with %% i.e %variable-name% .

Eg:
@echo off
echo %name%
echo %age%  
save the file as .bat

Next session we are going to see about GoTo Statements that operated as loop.

Close application in cmd or command line!!!

Hey in our last session we did explore the variety of stuffs of creating a script that would start an application.
Now we are going to Learn how to End or Close the application..
Every application that runs on your desktop are nothing but process ,you could explore its name by checking the task manager (ctr-alt-Del) .
or type tasklist in cmd.

We use TASKKILL Command to terminate an application.
Exit command is used to terminate cmd .exe itself

Syntax:
TASKKILL /IM application.exe

eg program:
@echo off
TASKKILL /IM  notepad.exe
exit.

In next lesson we would be learning of  declaring varialbles.....

Run application in batch


Wanna run applications , In windows!!!
                      The command used to start an application , you must use the START Command.
syntax:
start application/filename.ext

eg program:

@echo off
start notepad
start cmd
start firefox
start internet explorer

save as start.bat.
result:It opens all applications on desktop.

is it Interesting .........
Well dont you want to know how to end or close the open application.........

@echo off ?

Hi fellas ,
               Well during our first session you would have got doubt of what @echo off was all about it is necessity to know the purpose.
So  I would say Batch scripts will also do lot of automated stuffs....
so In this case we find default status as @echo on we could turn it off by using the command @echo off.
it is used to provide less details.
That's all you need to know!!!

Syntax:@echo off


Wednesday, 12 June 2013

echo command



Hi again!!!
Welcome to lesson 1
Echo Command  helps you to print text,nos and symbols it is like any other c,c++ print statements.

Syntax:Echo your text........
So that's it.......you know what to do ..
step 1:open cmd
step 2:type in "   echo hello hackers      "

it prints hello hackers....


Now here Your script goes here......
step 1:open notepad
step 2:type

@echo off
echo "hello" 
pause

step3:save as echo.bat and run.....
.
learn an extra command ...(cls is used to clear your screen).
Now you are just few steps to master the scripts...............Congratulations.

What are Batch Scripts!!!!

Every one feels complete when they atleast start something and complete it successfull.
So lets start .

Question arises in every mind , on hearing this.

Batch Script!!!
Is batch script a virus ?
Gabriel says "No it is not".

"Batch script is anything like a command that lets you to control and access your systems functionality in windows .this is equivalent to Linux shell scripting but not.
probably every one use it to automate the system and its function "-Gabriel

Extension to be saved is .Bat(batch)
e.g :filename.bat

Requirements:
Notepad++
wordpad

What is Ms Dos???


Ms Dos was developed in the years 1980's  and Microsoft licensed it to be theirs but now its purely an open vendor as for i heard.
Ms Dos stands for Microsoft Disk Operating Systems.
Ms Dos was called also as  Q DOS i.e Quick Dirty OS.

I don't think so!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.

According to me its really a great Os that has lots of fun and knowledge hidden beneath it.

You Don't believe me as i Suppose!!!!.

 Here it is believe now:-

Dos has been into life hidden in the bloodlines of every windows.
Like Linux ,Dos has been added to windows in more of  necessity  towards networking because of this it is said even windows has its running it in background.
commands eg: netstat  ,ping ,arp ,ipconfig,netsh,netview..etc..

Dos is also a greatest blessing for windows and also a curse due to prevailed exploits.
Do you understand what is dos now!!!