Jump to content

Recommended Posts

Posted

Welcome to the ultimate guide of batch scripting..

Take a look here.. :D


Index

  • Introduction
     
  • What is Batch?
     
  • A History Lesson
     
  • Requirements
     
  • "Hello World"
     
  • FAQ

 

 

Introduction

 

Ever wanted to know everything about batch? I don't mean the basics, I mean EVERYTHING. Well, you have come to the right place! This thread will leave you stuffed with information. By the end of this, your brain will be overflowing with knowledge. :D

 

What is Batch?

 

Well, Batch is a scripting language. Using Batch, you write a batch file, a compiled text file containing commands that will run in order. The name "Batch" was given to this language because a batch file contains a bundle or batch of commands. Batch files were made to finish tasks in a shorter period of time. Batch files also keep your operating system working. In every windows operating system, there is a least one batch file that is crucial to the operation of Windows.

 

A History Lesson

 

As the Windows OS evolved, so did the use of batch files. Long ago, in the early OS versions, batch files were extremely crucial. Early versions of Windows had batch files that actually made the OS start up properly. Over time, batch files became less useful. Windows could sustain most of its frame without the help of batch files. But in a couple of years, batch files became a source of entertainment. How? Well, some people saw the advantages to batch and its endless possibilities. Soon after that, a new era was born. People started making batch games, applications, and even found ways to create simple antiviruses with them. Batch files are still a popular success today. Without those brilliant minds, I wouldn't be writing this guide.

 

Requirements

 

So, most of you may know that all languages have requirements. Usually some special program. For example, C++ requires an IDE and a Compiler to work. So for Batch, is it the same? No. Not at all. All you need is:

Notepad

 

That's it! The only program you need is Notepad. If you don't know yet, notepad is already on your PC. Can't find it ??? Just go to Start Menu > All Programs > Accessories > Notepad. Now... are you ready to write a batch file? :)


"Hello World"

 

Ok, are you ready to write your first batch file? :P Let's get going! First off, open up Notepad.

 

The first line of code we are going to learn is @echo off. Now what does this line do? Well, it stops your batch file from showing file paths. It makes your program look professional. Just make sure you have this in the first line of notepad.

 

So, your notepad should have this in it:

@echo off

 

Now, have you ever wanted to make your program say something? Well if you do, you have to use the echo command. If I wanted my program to say "Hello World!”… I would type this on the second line of notepad:

echo Hello World!

 

So, now your notepad should have this in it:

@echo off
echo Hello World!

 

Let's just say this is our program. Nothing else. If we saved it (you will learn how to later) and ran it, it would pop up then close in less than a second. Why?!  Well, you forgot to tell the program to Pause! What, did you honestly expect it to pause by itself?  So, how do you make it pause? Well, you just put the command pause on the next line. So your notepad should look like this now:

@echo off
echo Hello World!
pause

 

So what actually happens when the pause command is processed during the run? Well, your batch file will pause and a message will appear. Your batch file will say "Press any key to Continue." Then when you press a key, it will move on to the next line of code. If there is no code left, the batch file will close. This may be a bit confusing, but let's run it and you will understand this.

 

So how do I run my program? Well, first you have to save it. Wait. I know what you’re thinking. You just going to go save it as a text document and then just open it. Yes, that is perfectly... WRONG! You don't save it as a text file. You must save it as a batch file! To do this, follow these three simple steps.

 

Step 1: Go to File > Save as

 

Step 2: Name your file but at the end of the name, insert ".bat" or your batch file will not work at all. For example, I can name it "My Program.bat" and that would work.

 

Step 3: For the "Save as Type" select "All Files" not "Text Files." (This is VERY important. If you don't do this, it will be saved as a text document.)

 

There, you have just saved your batch file! Now it's time to run it. Go open the file you just saved. If it does not open, right click the file and select "Run as Administrator." Once it is open, it should look like this:

JPWyN.png

 

First of all, Well Done! You have just made your first batch file! Now, do you see what the Pause command did? It made the batch file say "Press any key to continue..." Then you pressed a key, and it moved on to the next line of code, which is nothing, so it closed.


FAQ

 

How do I Edit my Batch File Again?

 

Just right click your batch file and click "Edit." It will then open up in notepad. Make your changes and then go to File > Save. Then close notepad and run your batch file again. All your changes should come into action.

 

My Batch File Won’t Run! HELP?!

 

Make sure you are on an administrator account. If it is still not running, right click your batch file and click "Run as Administrator." The batch file should run. If it does run but it just closes automatically, then there is an error in the source code you wrote. Go back and check that again.

 

Credits:Me

Posted

Really Amazing guide,+1 for your job ITS JUST AMAZING

+1 Rep for a guide that shows you have to create an hello world application? Bah..no

 

Thanks for sharing but it's totally for starters.

Guest Elfocrash
Posted

Really Amazing guide,+1 for your job ITS JUST AMAZING

karma fixed.makin a report for your karma abuses.

Guest Elfocrash
Posted

I found it really cool & he made a lot of job to make this guide.

We have +1 to reward people for their job.

yeah ofc.but if it is THEIR job and if it is something unique or saves money for us like raule and psomas' shares or irat shares.not a thing you can just google and get 1million results

Guest Elfocrash
Posted

Let me google that for you

 

About 2,790,000 results (0.27 seconds)

 

yeah so unique

 

Who cares if is it in mxc as long as it is the most common thing and completely useless?

Posted

1: Theres no way you could have written this yourself with your English level

2: Ultimate guide? -____________- going over 'echo' isn't really that advanced or helpful in any way

3: Maybe you should know what you're doing first before 'teaching' it to other people

Posted

It is a very good guide but I have to agree with Elfocrash. It does not deserve karma for the reason, that a tutorial like that can be found easilly on the internet.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Posts

    • Yeah inside router i had to enable udnp services 
    • Hello cheaters, As a team of avid developers and enthusiasts of Lineage 2, we are excited to present the L2 Control Hub, a groundbreaking plugin designed by myself and my collaborator, StinkyMadness. This innovative tool equips server administrators with powerful automation capabilities directly within the game's community board. L2 Control Hub simplifies the creation and management of automations, enabling you to customize your server operations without the need to modify the source code.   Key Features of L2 Control Hub: Robust Automation Triggers: Select from a plethora of triggers currently available, with continuous additions in the works to enhance your control options. Dynamic Conditions and Actions: Tailor your server operations with an extensive range of conditions and actions, ensuring flexible and precise control over game events and player interactions. Customizable Variables: Easily integrate server-specific variables from your database to further personalize and streamline your automations. Utilize these variables across various automation scenarios to cater to your specific server requirements. JavaScript Integration: Execute custom JavaScript codes that interact seamlessly with Java classes, bringing advanced functionalities to your server's ecosystem.   Explore L2 Control Hub in Action: We've prepared a series of video tutorials to demonstrate the capabilities of L2 Control Hub: Control Hub - Create a Simple Flow with 1 Condition and 1 Action: Get started with basic automations. Control Hub - Multiple Conditions with Multiple Actions: Explore more complex automations for detailed server management. Control Hub - Using Variables: Discover how to implement and use custom variables for tailored automations. Control Hub - Using JavaScript: Experience the power of custom scripts in enhancing your server functionality.   L2 Control Hub is currently about 70% complete, and we are actively developing and refining features. We invite you to join our ➡️ Discord community ⬅️ to engage with the development process, provide feedback, and be the first to test new features. Additionally, any updates or changes to the plugin are seamlessly delivered to all customers directly from our web server, ensuring your system is always up-to-date without the need for manual downloads.   Your game, your rules, automated. Join us in redefining server management in Lineage 2 and elevate your gaming community with unmatched automation capabilities. For more details, contact us directly to get started with L2 Control Hub.   Currently, the plugin is developed using aCis sources. We will continue with these sources until we finalize all the necessary details before proceeding to integrate with the more prominent sources available.       The L2 Control Hub is designed to extend beyond mere functional additions to your server. We are in the process of implementing a suite of advanced mechanisms, such as a vote manager capable of interfacing with any Lineage 2 voting site without requiring configuration, live statistics to provide admins with real-time insights, and an event engine that can generate any desired event within seconds. All these features will be seamlessly integrated into the module, enhancing your server management experience significantly.     Please note that L2 Control Hub will be a premium tool, reflecting the extensive features and benefits it offers. While we are finalizing the pricing structure, rest assured that we aim to deliver great value for your investment. We will announce the cost details soon on our platforms to ensure everyone is well-informed and can plan accordingly. Join us to take your server management to the next level with L2 Control Hub.     
    • The link soucer and system are off, reup please, thanks very much @HypeH
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt  
    • Hola, Busco proveedores de adena en Reborn signature. Trabajo serio, Web de ventas Seria. Adena-Shop. Discord: susi007317   Hello, I am looking for adena suppliers in Reborn signature. Serious work, Serious sales Web. Adena-Shop. Discord: susi007317
  • Topics

×
×
  • Create New...