Welcome
Welcome to the forums of AntiRTFM's Absolute N00b Spoonfeed C++ Tutorials!

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join our community today</a>!

Tutorial: Coding and understandin basic CMD applications

C++ Stuff belonging in global scope pretty much

Tutorial: Coding and understandin basic CMD applications

Postby DIGI_Byte on Thu Oct 08, 2009 12:04 pm

Hey, I'm NOT a programmer/coder and have no official idea what I'm talking about, I'm self taught from trial and error, If I'm wrong please correct me.
here is a nearly finished example of a basic and working CMD application
http://codepad.org/bkpjOMdt

Recently I've taken an interest into C++ to replicate my initial application (link above), Most small applications made by people who don't know about C++ tend to make .bat files this is a common method used for making small mods and updating files etc, Its very basic and uses the standard CMD commands

I will use my .bat file code as a reference, You may view commands here

To make a .bat file, simply make a .txt file and edit it from their,

In my code above, the first line tells CMD to ignore printing processes ~ (@echo)

the next command tells Dos to print what ever appears next to it ~ (echo)

the next feature is a comment, it tells the following text is to be skipped ~ (::)

To change the scripts location or viewing directory, you can change by using a command ~ (cd)
(Current Directory)

You can also move/rename files ~ EG line 26

you can rename files as a whole directory as seen on Line 25

on Line 77 is a run command, this works on any application, In mine I'm running a Game called Battle for Middle earth 2, with a " - " Command depending on the application these will vary
for BFME2 " -mod "C:\my directory\_files" forces the specified file or folder to over right the games original files with out harming the original game



(please note: %AppData% is a scripted window command that opens a specific windows directory, there are many more, but I'm not aware of their names)

When you quote directories that have spaces it's highly recommended that you place the directory in a "double quotes" or the application will get lost

Its important to understand that each command MUST be on separate lines, this type of code is also explained in the early spoon feed tutorials
and after every command (echo, ::, etc... ) MUST be followed by a space

you can also jump from commands to other commands but I have not explored that area.
You can also create simple Dos GUI's and other misc features seen in old Dos game installers, Again this is out of my capabilities


This is my first semi-tutorial, If it you guys also find it useful, I might apply more time to filling it out, But this is more to explain the basics of how CMD files work so if some one asks to read or remake it into a C++ program you may understand easier
DIGI_Byte
 
Posts: 9
Joined: Tue Oct 06, 2009 11:49 pm

Return to General

Who is online

Users browsing this forum: No registered users and 0 guests