Best Command prompt Hacks Top 10 Batch Scripting

Best Command prompt Hacks

Welcome back to another interesting post by CYBER GEEK so today we are going to see tricks for command prompt.I hope that you guys  understand or know about Batch scripting so basically this tips and tricks of CMD is related with our Batch scripting in batch scripting we write certain codes and it perform certain tasks as per the written code now in today’s post I will be showing you guys a simple script from batch scripting which  can be used in our command prompt to communicate with other computers which are connected on the same network.  

If you guys are interested to learn more about batch scripting you guys can go to my YouTube channel call CYBER GEEK over there you can see a series is going on, Virus series right now I am teaching about batch scripting and furthermore I will be teaching about how to create backdoor, ransomware, Malware, keyloggers and many more. You can enjoy the video representation so that you can learn more about it but in today’s article or post I am just going to share a simple code how can you communicate with other people on the same network let’s stop wasting time and dig in.  

So first of all what you have to do is that open your system as you have done I hope so . So,once you open You have to create a empty text folder you can open anything a document or notepad basically if you have notepad it is much better just open Notepad empty Notepad and you have to type certain commands.

So if you are following me on my YouTube channel where I am teaching the batch scripting it will  be much more easier for us to understand what is batch scripting?  and how to code in them right so you guys will have a better understanding if you are following me through the virus series so that I do not have to go too much in depth and explain the same thing again and again over here so as I am writing this post basically I am gonna explain everything in detail So let’s just start the coding.

Batch Script: Chat with your friends using Command prompt

@echo off:classClsecho MESSENGER

set /p n=User(Enter Your Friend’s IP Address):

set /p m=Message(Type Your Message Here):msg %n% %m%pausegoto class

Explaining How the code functions

Ok so let me explain you the code line by line over here so that you can understand what is going on then we will move further with the execution of this code.

@echo off

So now if you see the code it says “@echo off” so what does it mean basically the same thing will be seen in many kind of batch scripts, there will be basically so many scripts that will be starting with “@echo off” take an example,you might have open your Notepad recently to copy this code right, so what did you see inside your notepad nothing basically it was fresh so this is what does it to your Terminal when you open new terminal you will see a path in their which is C:/Users/Device Name/  now if you pass @echo off inside your terminal  it will remove the C: path written over there and it will give you a fresh terminal where nothing will be written and basically so whatever you type  after the echo off  those message will be printed. 

So basically when we you guys will be executed this you might be seeing something this coming up over there which is written as MESSENGER then your User(Enter Your Friend’s IP Address) then you will be seeing a Message(Type Your Message Here) right so if you just remove the “@echo off”   then you might be seeing the C path as well as the message printed by your script so this is why we use “@echo off” to remove any unwanted messages from the terminal so that whatever we are writing should be printed in an arranged manner and it should avoid confusion so this is why you use “@echo off”.:classClsecho MESSENGER

set /p n=User(Enter Your Friend’s IP Address):

set /p m=Message(Type Your Message Here):msg %n% %m%pausegoto class

  • So basically if you see the whole code which is presented right now you might see something different inside this code and if you notice the top part of the code and the bottom part they look something similar to so what does it look similar to, it’s a looping statement. 
  • How can we call it as loop because we’re defining a class  by writing “:class” and we are calling that particular class endless time there is no parameters set that how many times we can call the class that has been set for endless time but in our case it is not going to execute endless time if it’s going to execute endless time your system will crash yes you guys do not know but your system will be down. So we will try to understand even though it is written “:class” and “goto class” why  this code will not execute an endless time it’s because there is a certain part mention in the script which is stopping it from executing an endless time so this is what we are going to see  step-by-step right now.
  • So “cls” basically if you have seen C++ programming or any kind of programming to clear out the screen inside a command prompt  we used to mention at the top as clear or cls  so that our code can execute and give you the result as per the code is written that’s what we want right so this is what we have done here we have also used “cls” to clear out the terminal.
  • So how do we print a string inside a terminal right so you can see it’s mention as “echo messenger” so why did we use echo over there to print the string inside the terminal.  For example if you have written as “echo I love programming” then the message will be printed as “I love programming” inside the  terminal.
  • So now  if you see it’s mention as “set /p n” So you might be confused what does it mean it basically says, the /p switch allows you to set the value of a variable to a line of input entered by the user. Displays the specified promptString before reading the line of input. The promptString can be empty. So here we might be confused what is this promptstring can be empty?.
  • So if you see there inside our code it is mentioned as user and enter your IP address  friends IP address right so it cannot be mentioned also this is what it means as the promptstring empty.  You might think that what is the use of mentioning the string here basically it provides you guidance right it says that you have to enter an IP address so that you will enter the IP address instead of a mentioning  any kind of  Random numbers here.
  • So now let understand the real meaning of set /p n right so take example of a programming language is it supposed to take in C programming how do we declare integer type by giving int  variable name an equal to and we assign the value right so this is how it is working for our purpose also  just considered as your set your int over their and n as variable name and whatever you are going to assign to it, it is going to take from the user.
  • So now if you see a line mentioned as MSG %n% %m%   so what do you mean by this command  over here , if you guys are watching my virus series please go and see the second video of  virus series episode 2 there I will be showing you representation of creating a random folder there you’ll understand the best meaning of this percentage(%) over here i’ll try to put it in words so that you guys will not be confused.
  • So why do we use %n% is that you might enter the IP address different time like some time it will be 192 sometime it will 172 so how this code is going to work for both of them so this is why we use %n% so you can give Random numbers so that it can accept all the random inputs so we’re not specified anything right so if you specify than our input will be limited so if you do not specify anything and we take random inputs everytime which is much better. Same goes for message we will be entering different messages every time to take all this random messages. So I hope you understand how to take random input all the time.
  • So if you guys remember at the beginning I said that this code will not execute an endless time because there was a certain parameter pass inside this code and that parameter was pause if the pause was not mention over there the code will execute an endless time and your system will be down Yes your system will be crushed so to avoid that we have mentioned pause over there if you mention the pause outside the go-to class the command is going to execute an endless time and it is also going to hold the terminal on the screen so basically it is a very deadly combination which you can find it on my YouTube channel in my Virus series you can see from the beginning and you can see the mistake which I have already made ,so remember that do not enter pause outside of the goto class always enter it inside to avoid endless execution of the code.Command prompt

So we are at the end of our code explanation and I hope you guys understand each line of the code and how does it function now let’s start the Representation which means the execution of the code and I will you show that with the help of the images that you guys can understand much better and how to execute it.

Executing the Batch Script in Command prompt

Follow the steps:

Step 1 : Open your notepad or any text editor type the code or paste it.  

Step 2 : Save the File as .bat extension if you don’t save it with .bat extension it won’t work look in the image. Navigate File>Save As .Step 3 : Find the saved file look the image for reference.  

Step 4 : Now click on the file and you will see a message asking you to enter the IP address and Message look the image for reference.

Step 5 :  This is very important point to keep in mind if you fail to communicate don’t be disappointed because the system might be protected look the images below I have shared I have tried to communicate between Windows 7 and Windows 10 and I have Failed. I tried to ping them with each other but they failed it’s because they are protected as My Main System is too protected. This doesn’t mean that the code has error it’s good thing that your system is protected and I hope you guys have not make any mistakes.

Step 6 : Now after entering the details Hit Enter and then you will be able to communicate with your friends on the same network. Remember if your system is protected you might get a error like me.

Conclusion 

I know it might sound disappointing but in my case it didn’t work so that was a little bit of introduction to Bash scripting but if you guys want to learn a lot in batch scripting then do follow me on my YouTube channel which links can be find on the website anywhere or as I will leave right below the post so that you can click and come on to my channel and you can easily enjoying the virus series which is going on and you can see the real time examples with visual and representation so that it will be much more interesting to watch and understand them in a very short amount of time see you guys in next Post till then goodbyee.

Leave a Comment