This group was created by Cody and I to teach the public how to code & program command prompts to create useful and fun codes.

Forum Thread
  Posts  
Command Prompt Tutorial #2 - The Adv. Basics (Groups : Command Prompt Coding & Programing (CPC&P) : Forum : Command Prompt Tutorials : Command Prompt Tutorial #2 - The Adv. Basics) Locked
Thread Options
Sep 15 2009 Anchor

Welcome back to another tutorial in a series of tutorials giving you a in depth, step by step process on how to code & program a command prompt or batch file.

Below you will learn:
-advanced codes & functions
-tips I use when creating a code

Now to begin. Like I mentioned in the first tutorial you need patience and dedication for anything in life to work correctly. So I'll start by giving you a few tips of what I do to create a successful code inside a command prompt.

You should set certain goals for yourself so your be successful in coding & programing a command prompt.

For instance, a short-term goal I use is to take it step by step and not to rush. Rushing will cause confusion down the line and could mess up hours of work and time put into it.

Errors are a big thing to keep an eye out for. If you ever come across an error it is best for you to confront it then and fix the problem. If ignored, the problem could mess up everything you code afterward.

Also save and keep a back-up file of your work. I usually save every 10-15 minutes. Although, if you have an older computer that tends to freeze, crash, or stop working then you'd better save every 5-10 minutes.

Remember to keep a back--up copy of your work. Whenever I finish for the day, I always save that notepad and copy + paste the whole code into another notepad. I save both the notepads again and then close out the notepads. This is a key tip to make sure you don't waste valuable time. These are just a few tips I use to make sure everything runs smooth. For more tips you can always private message me.

Now onto the advanced codes & functions. There are a few here that your need to known before continuing on. Those few will be in blue text.

Here are the 8 codes:
-title command prompt
-:titles
-set
-if
-/p
-goto
-*msg
-titles%

Each one of these codes have a function. Some of the functions your need to know. Some aren't so important.
-title command prompt - this will add a title to your command prompt which will be shown on the command prompt.
-:titles - these are the key features to any successful code, they act as the backbone support
-set - this will allow the code to read what you want done, this will be shown in a example
-if - this will allow the code to recognize that you want something done but needs to wait until the player asks, this will be shown in an example
-/p - this tells the code that this certain part is for the player, which is you
-goto - this code tells the command prompt to "goto" some other :title
-*msg - this is similar to the echo command and is used in the same way but in different cases
-titles% - this tells the command prompt to go there, this will be shown in an example

Now that you have a feeling of whats ahead. If your not fully comfortable with these codes & functions then here is an example: (These examples are going to be done different than in Tutorial # 1 because some codes are used way later in the command prompt)

Titles -
@echo off
cls
title Tutorial Test # 2
echo Hello this is a test to see if I know how to do titles
echo If your seeing a title in the command prompt then you've successful got this code & function down
pause
exit

:Titles -
:COMMANDERNAME
cls
echo.
echo Please enter your Commander's name.
set /p commander="< "
if commname%==1 (
set comname=0
goto commander
)
Do not try and copy/paste this into a notepad because it will not work. This is just showing you what it would look like in the code form.

:set -
set story=0
:story
cls
echo.
echo (story goes here)
echo.
pause
exit
Do not try and copy/paste this into a notepad because it will not work. This is just showing you what it would look like in the code form.

If -
if exist "us;erprofile%\My Documents\FFSave.txt" goto continueop
if exist "us;erprofile%\Documents\FFSave.txt" goto continueop
This is part of a code that was used to configure the games save code & function. Do not copy\paste this into a notepad because it will not work. Again, showing an example of how it would look in the code form.

Ti;tles% -
if st;aname%==1 (
set staname=0
goto commander
)
In this case, "staname" is what we used for station name. We used set staname = 0 for the code & function for us to set up the command prompt so it would recognize the command.
Whew, I knew that was a lot to take in and it may not be very clear. I'd advise you to read over this again a time or two then view some tutorials on these codes that demonstrates them in a video or image.

If you have any questions please refer to the "Help" section of the forum. If you have comments or suggestions please post in the "Reply" section of this thread.

NOTE - For technical difficulties the previous thread, "Batch File Tutorials #2 - Advanced basics", has been deleted and this one takes its place.

Thanks, Keromalas

Edited by: Keromalas

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.