Friday, November 21, 2008

Qbasic - FAQs

Qbasic - FAQs

1.0.0 What is BASIC?
1.1.0 What is Qbasic?
1.1.1 Why QBasic?
1.1.2 Where can I find it?
1.1.3 Qbasic's limits and capabilities.
1.2.0 How does Qbasic differ from Quick Basic?
1.2.1 From GW-Basic?
1.2.2 From Basica?
1.3.0 What is an "interpreter"?
1.4.0 What is a "compiler"?
1.5.0 Compiling your basic programs.
1.6.0 Where do I find QuickBasic?
1.7.0 Using other compilers.
2.0.0 Loading programs.
2.1.0 Why won't my program load in Qbasic?
2.1.1 "Bad file mode"?
2.2.2 "Syntax error"?
3.0.0 Program structure.
3.1.0 What is modular programming?
3.2.0 What's the difference between SUB module and a GOSUB?
3.2.1 When should I use them?
3.3.0 What is a function?
3.3.1 Why should I use them?
3.4.0 What is event programming?
3.4.1 Is QBasic an event driven language?
4.0.0 Enhancing programs
4.1.0 How do I use the mouse in my QBasic programs?
4.2.0 How do I get more colors in my QBasic programs?
4.2.1 What is a color attribute/value?
4.2.2 How do I change them?

--------------------------------------------------------------------------------

1.0.0 What is BASIC?

"BASIC" is an acronym for the name of just one of the earlier high-level languages built for use by early programmers. The letters stand for: Beginner's All-purpose Symbolic Instruction Code. It's main purpose was to be a language that allowed the user to develop code quickly and easily, without a lot of knowledge concerning low level, or assembly language.

Although not actually written by Microsoft™, BASIC was ported by the then-small company for use on the personal computer. Bill Gates helped construct the code for what was considered the "first" personal computer... the Altair. Prior to BASIC early code was "toggled" in on the front panel one line at a time using switches. It was probably one of the first true "killer aps". With BASIC, a person that owned one of these early computers could write programs that were simpler to construct than machine language. It wasn't long before the personal computer grew to be more than a curiosity; probably due in part to the popularity of BASIC.

For more on the history B.A.S.I.C. try here: www.truebasic.com

--------------------------------------------------------------------------------

1.1.0 What is Qbasic?

Qbasic is a truncated version of QuickBasic(tm). It was developed by Microsoft from QuickBasic for use and inclusion with DOS 5.0 and later. QBasic is a run-time interpreted language that comes with a full featured editor and debugger. It supports more features than previous products, such as MS Basic, BasicA and GWBasic.

--------------------------------------------------------------------------------

1.1.1 Why QBasic?

Of course the appropriate response here would be... Why not?
It's FREE, easy to use, and compact. Beginning programmers now have an easy medium in which to "stretch their legs". QBasic will allow the programmer to develop code that has modular structure, in a much friendlier environment. QBasic is much more powerful than other "beginner" languages that previously were free with an operating system.

--------------------------------------------------------------------------------

1.1.2 Where can I find it?

Try Googling around for qbasic.

Following files are needed
QBASIC.EXE - The actual editor/interpreter program.
QBASIC.HLP - The help files for QBasic.
QBASIC.INI - Not necessary, since QB will create a new one.

--------------------------------------------------------------------------------

1.1.3 Qbasic's limits and capabilities.

Variable-name Length: 40 characters
Strings: 32,767 characters

Double-precision numbers:
1.79769313486231D+308 to -4.940656458412465D-324

Video:
CGA,MCGA,EGA,VGA,Olivetti and Hercules support.
Up to 262,144 colors with from 4 to 256 displayable.

Structure:
64K Main module level.
With included modules up to 125K

No line numbers (Optional)
(More specific information is available inside QBasic's HELP documentation.)

--------------------------------------------------------------------------------

1.2.0 How does QBasic differ from Quick Basic?

QBasic is very similar to QuickBasic. QBasic is actually a truncated version of QuickBasic, a compilable version. QuickBasic supports two(2) ways of program compilation:

Requires a run-time module, to interpret the QuickBasic Code.

Will create stand-alone compiled *.EXE files.

QuickBasic also supports libraries that can be compiled at runtime, but have been previously created. These libraries are interchangeable with other "Quick" products like Quick C, etc.

QBasic is not entirely the same as QuickBasic, in that some code modification may be necessary to get the QB code to run on QuickBasic, but more importantly, QuickBasic code needs to first be saved in ASCII text format and edited to remove unsupported commands for it to run in QBasic.

The easiest way to tell which one you have, is by looking at the version number... QB is usually ver 1.1, while the most common versions of QuickBasic are 4.0 and 4.5.

Note: version 7.0 is commonly called PDS. (Professional Development System.)

-------------------------------------------------------------------------------

1.2.1 From GW-Basic?

GW-Basic supported many of the features that QBasic does, yet others have been dropped. GW also could be compiled if the compiler was purchased separately. QBasic can run old GW files provided they are edited for unsupported commands, are syntactically correct, and in ASCII text file format.

GW Basic command structure and syntax was mostly comparable. QB changed the syntax on several commands, (Some support two syntax structures.) GW required line numbers; QB does not.

(Trivia note: The `GW' in GWBasic actually stands for Gee Whiz.)

--------------------------------------------------------------------------------

1.2.2 From BasicA?

BasicA (Microsoft Advanced Basic), supported many of the features that QBasic does, yet others have been dropped. (Namely cassette drive support) BasicA programs also could be renamed and accompanied by a run-time interpreter for use as stand-alone programs. QBasic can run old BasicA files, as long as line continuance characters are removed, (the hyphen), and provided they are edited for unsupported commands and are syntactically correct, and of course, in ASCII text file format.

BasicA command structure and syntax was mostly comparable. QB changed the syntax on several commands, (Some support two syntax structures.) BA required line numbers; QB does not.

--------------------------------------------------------------------------------

1.3.0 What is an "interpreter"?

An interpreter is a program that reads the source code and translates it's output as code that runs as a program. The "translation" is a run time compilation to memory only. It is full compilation, (Unlike the line-item compilation of past interpreters.) This is done every time the program is invoked, and can be much slower than a compiled program. (This form of compilation makes QBasic faster than previous languages, but still not as fast as a fully compiled EXE.)

This differs from a compiled program where code is actually ready for execution when the program is invoked. Compilation needs only be done once to create the program. Compiled programs cannot be edited, the source code must be edited, then recompiled.

--------------------------------------------------------------------------------

1.4.0 What is a "compiler"?

A compiler, whether stand-alone or part of the editor environment, is a program that takes source code and generates an executable program that can stand alone.

Compiled programs are desirable for several reasons:

They can be run without a copy of the interpreter (QBasic).

They execute much faster, than interpreted code.

The source cannot be edited, accidentally or otherwise.

Compiled programs are *.EXE files but can also be named *.COM files.

QuickBasic supports two methods of compilation; one that requires a run-time module, and one that creates a stand alone EXE file. Most programmers choose to compile to EXE, to reduce the chances of the user losing the runtime file.

--------------------------------------------------------------------------------

1.5.0 Compiling your Basic programs.

In order compile your Basic programs, you will need a compiler.

One IS NOT included with QBasic.

You can get a compiler for another version of Basic though. You can then compile programs using it, provided that your QBasic code has been edited to be syntactically correct with the compiler. Many compilers available today are closely compatible with QBasic, with QuickBasic being the most compatible. (Generally speaking, if the source code RUNS in QBasic, it will run IN QuickBasic, but compilation may require that the programmer, use proper programming techniques, conventions and structure to facilitate a correct compilation to *.EXE).

Many professional and shareware compilers are currently available, some are quite good. Each will of course, have it's own supported syntax, but with a little modification, your QB code can be complied.

--------------------------------------------------------------------------------

1.6.0 Where do I find QuickBasic?

Unfortunately, Microsoft stopped marketing and sales of QuickBasic many moons ago. MS' attention has turned from DOS-based programming languages to Windows, event-driven languages. (Visual Basic, Visual C++, etc). Some Internet software marketers still carry QuickBasic as it was last released, but finding a place that actually sells it, or has a copy available for registration is difficult. If found, the price of QuickBasic hasn't altered much since it's release. At last check, the best price found was for $89 American dollars sold through a marketer in the U.K. Other places were selling it for as much as $145. If you search the Internet and WWW you should be able to find several places that still offer not only QuickBasic, but other compilable Basic languages too.

You may also discover some less-than-reputable types that offer QB4.5 free for download. Downloading such a copy is not recommended, as QuickBasic is still not released for such use.

* * PLEASE NOTE! - Copying QuickBasic down from another computer will not get you a registered copy. Registration for older software is keep at the developer. Most software developers don't usually transfer registrations either. Pirating a copy is considered illegal. UWLabs does not encourage, nor does it support software piracy. UWL's own products had to be compiled using a borrowed computer with a registered version of QuickBasic. Other programs had been compiled using demo's of other compilers available as shareware. It is recommended that if you wish to compile your programs, that you try some of the other products available today, first. Many of these products will allow you to compile your programs, even before you need to register.

--------------------------------------------------------------------------------

1.7.0 Using other compilers.

Other compilers may seem foreign at first, but all program editors work on the same basic principles. You made need to adapt to the different programming environment, and also to the new compiler's command syntax. Good compilers/editors will include documentation to help with the transition. A tangible side effect of using other compilers, is that you will learn to create code based on structure rather than language.

--------------------------------------------------------------------------------

2.0.0 Loading programs

Simple program loading is available in QBasic. Almost any TEXT file can be loaded into the editor. (ASCII formatted text is of course, expected.) QBasic's editor also supports "edit" mode where the editor can be used to create text files.

To launch just the plain text editor, type either one of the following at the C:\> prompt:

C:\> edit
C:\> qbasic /e

Note: on Win9x machines, EDIT will actually invoke MS' newer DOS-like editor EDIT.EXE, Where the "/e" will force QB to be the editor.

--------------------------------------------------------------------------------

2.1.0 Why won't my program load in Qbasic?

It is possible that the program you acquired was not written in QBasic. Or if it was written in QuickBasic, the author did not save the file in ASCII format. Often times program authors will post their wares, then in an effort to save time, will refer to QuickBasic as QBasic. As previously stated, QuickBasic *.BAS files may not necessarily load into QBasic. (You can thank these authors for further confusing new QBasic users, by referring to QuickBasic as QBasic).

It is also possible that file was created by any one of the following BASIC programming languages; QuickBasic4.5, QuickBasic PDS, TurboBASIC, Visual Basic, BasicA, GW Basic, Apple Basic, Tandy Basic, Microsoft Basic, and many, many more.

--------------------------------------------------------------------------------

2.1.1 "Bad file mode"?

GW Basic, QuickBasic, and BasicA, all used a binary save format. This format was created to save disk space on early computers. QBasic *.BAS files are saved ONLY in ASCII text format, so any file that displays this error cannot be loaded into QBasic, unless it first is loaded into another Basic editor and saved as ASCII.

NOTE: Just because a file has a *.BAS extension, does not necessarily mean that it is a QBasic file. It could be one of any number of Basic program files... including Visual Basic.

-------------------------------------------------------------------------------

2.2.2 "Syntax error"?

The word that is highlighted in your editor, is not recognized by QB as an accepted command, variable name, line identifier, or other supported programming convention. Either it was keyed-in incorrectly, or...

Again the file may have been created in another editor, with different language syntax. You will need to find out the QBasic method of performing the specified task, and modify your code accordingly.

--------------------------------------------------------------------------------

3.0.0 Program structure

QBasic provides the beginning programmer with the tools to learn to program. HOW the new user chooses to create his/her program is their choice. Program structure should be of accepted standard so that when the source code is shared, (as you more than likely will do), it is comprehensible. Good structure will include clearly defined TYPES, SUBS, MODULES, and LOOPs. Good QBasic structure will also include clearly named variables, line identifiers, arrays and files. Loops should have a minimum of exit points, and subs should not branch unpredictably.

It is also considered good practice to include comments for your code, and use line indents, for each loop level.

The old adage of "GOTO is poor programming practice" rings true.

--------------------------------------------------------------------------------

3.1.0 What is modular programming?

Modular programming involves building a program in such a way as to create it in specific sections; modules. This can be done using SUB declarations, GOSUBS, and FUNCTIONS. Using modular structure is preferred because, elements that need to be repeated can be created once, than invoked repeatedly. Good programming practice will also allow you to "transport" SUB modules for inclusion in other programs you create.

A good example:

DECLARE SUB Center(RowPosition, Text$)
'
Center 12, "This text is centered."
Center 13, "So is this text example."

END
'------------------------------------
SUB Center (RowPosition,Text$)
Column = 40 - INT(LEN(Text$)/2)
LOCATE RowPosition, Column
PRINT Text$;
END SUB

The above example allows the programmer to call the SUB Center() any time he wishes to print centered text to the screen.

Now in the QB environment, the SUB would not be shown in the main edit window until it was chosen from the menu. Keeping the SUBs separated like this makes it easier to concentrate on the task at hand, and moves the coding to it's own separate "page" so to speak.

--------------------------------------------------------------------------------

3.2.0 What's the difference between a SUB module and a GOSUB?

QBasic allows the programmer to create SUB modules that are accessed separately from the main module, where GOSUBS are program directions that are invoked at any level.

Similar to a GOTO, GOSUB routes the program instructions to a new line to execute that code. The last line will need to be RETURN, so that program execution returns to the line of below where it left out. QB allows for a RETURN Line Identifier, but that also allows for poor programming practice. You should just RETURN where you left from to avoid unexpected results.

SUBs are separate modules that are created with the DECLARE SUB statement. Module level SUBs are great for redundant and recursive operations, and they accept parameters. The parameters are passed at the time of CALL, and usually are what the SUB uses to complete it's work. (See the example in Modular programming.) The RowPosition and Text$ are parameters.

Declared SUB routines are unaware of variables in other modules unless they are passed as parameters, or defined as SHARED. (Hint: You can use COMMON SHARED, but it uses more resources than if you DIMension them shared.)

A secondary benefit to creating SUB modules is that the amount of memory used for program loading is not as affected by the module size. Main Module level is restricted to 64K, but module code can be included making it much larger.

--------------------------------------------------------------------------------

3.2.1 When should I use them?

Use SUBs any time you need to do some work repeatedly, or any time it can be used to save coding steps, or if you would like to separate a section of code from the main module. USE GOSUBs when you want to keep the work locally, and there isn't a need for passing parameters, or if the work needs access to variables that aren't shared.

The nice thing about GOSUBs is that you can use them inside SUB modules. Effectively skipping to that module as if it where another program in itself.

--------------------------------------------------------------------------------

3.3.0 What is a function?

A FUNCTION is similar to a Declared SUB. It too is DECLAREd, and uses parameters that can be past when it is invoked. The main difference is that the FUNCTION is used more as a way to add to QB's already defined functions/commands. A function (typically), is used to do some mathematical operation. Be it a Boolean choice, or an algebraic function.

Once DECLAREd the FUNCTION can be used much like a command already in QB.

Example:

DECLARE FUNCTION Area (Length, Width)
'
INPUT "Enter the width"; W
INPUT "Enter the length"; L
Total = Area(L,W)
PRINT Total

END
'------------------------------------
FUNCTION Area (Length, Width)
Area = Length * Width
END SUB

Not the best example, after all, you could probably calculate the area, right there inline much faster, but it shows a simple example.

FUNCTIONs need not necessarily be mathematical in nature, the "SUB Center" example could easily have been a function instead. A FUNCTION needs to have at least on value to return when called.

--------------------------------------------------------------------------------

3.3.1 Why should I use them?

Good programming practice dictates that whenever you can create a module of any type to support your coding, you should. If it can be done easier, and repeatedly though a FUNCTION, then by all means, you should create a FUNCTION to do it. A well written function can be called time and time again with just a command, and save so much coding. The benefit is that FUNCTIONs can be recursive. Meaning that it can call itself! (This applies to SUBs too.) That way a simple task can be repeated until a condition is met, and it then becomes a complex task in very few lines of code.

--------------------------------------------------------------------------------

3.4.0 What is event programming?

Before the advent of Windows, most software was not programmed in event driven languages, but rather polled languages. Event programming is somewhat easier because, cause and action inside the program are based on the "event" taking place, rather than polling. (Continually checking a device, a variable, etc.)

The best way to explain this is with the way the two different methods handle mouse routines. In polled language, you must create a conditional loop while using the mouse, and once the condition is met, and action is taken. (Say using IF/ THEN or possibly SELECT CASE.) Then you must continually check to see if the mouse has performed the action.

In an event driven language. You construct the program to handle an event when it occurs. Example: OnMouseClick PressButton1% The operating system reports the event through the kernel, and you then can handle it.

--------------------------------------------------------------------------------

3.4.1 Is QBasic an event driven language?

Absolutely not. BUT, you can still make use of some simple QB commands that will help your program BEHAVE like it is event driven. Commands like WAIT, ON ERROR. ON PLAY, INP(), etc.

--------------------------------------------------------------------------------

4.0.0 Enhancing programs

QBasic allows for more commands and structured code to enhance your programs over previous Basic languages. VGA support, SUB and FUNCTION modules, and a way to include ASM (Assembly) language through CALL ABSOLUTE.

With the addition of these "upgrades," programs can be more colorful, and can include newer devices that may have not been planned for at the time of Basic's creation. Devices like the mouse as opposed to the light pen or joy stick.

--------------------------------------------------------------------------------

4.1.0 How do I use the mouse in my QBasic programs?

Suffice to say, that there are several good ways to get the mouse to work in your QB program. But there isn't enough space here to fully explain. Download mouse-it.bas from the files section, and it should get you well on your way to using the mouse in your programs.

--------------------------------------------------------------------------------

4.2.0 How do I get more colors in my QBasic programs?

QBasic is capable of the following amount of colors in their corresponding screen modes:

Screen Mode Resolution Foreground Background
0 40 to 80 by
25 to 50 characters 32* 16
1 320 x 200 pixels 4* 1
2 640 x 200 2* 1
7 320 x 200 16 1
8 640 x 200 16 1
9 640 x 350 16* 1
10 640 x 350 8* (b&w) 1
11 640 x 480 8* (b&w) 1
12 640 x 480 16* 1
13 320 x 200 256* 1
* 16 Blinking
* Pseudo colors
* Out of 4 palettes of 4 colors
* Out of 64 in the palette
* Out of 262,144 in the VGA

Depending on the current screen mode, you can use the COLOR, command to change the current color, or change a background color. Other colors available to that particular screen mode can also be replaced using PALETTE or PALETTE USING.

--------------------------------------------------------------------------------

4.2.1 What is a color attribute/value?

A color ATTRIBUTE is a number that describes the color CHOICE directly from a list of colors available, where a color VALUE is a 4-byte color DESCRIPTION of a blend of the three colors that compose a monitor. Those three colors are: RED, GREEN, and BLUE. Hence the abbreviation RGB.

Here's an example:

Color Name Attribute EGA Value VGA/RGB Value
Black 0 0 0
Bright Red 12 12 63
Bright Green 10 10 16,128
Bright Blue 9 9 4,128,768
Bright Yellow 14 62 16,191
Bright White 15 63 4,144,159

Wow! Would you look at the size of those numbers! Why so high? Simple. RGB Values are calculated using a VERY SIMPLE formula, and here it is:

Value = (Red * 1) + (Green * 256) + (Blue * 65536)

Where "Value" is the 4-byte color descriptor and
"Red", "Green", and "Blue" are numbers from 0 to 63.

In the above example, (Bright White), the Value is 4,144,959.
Applying the formula:

4144959 = (63 * 1) + (63 * 256) + (63 * 65536)
Br.White = Max.Red + Max.Blue + Max.Green

So, by adjusting any of the RGB values, we can create any color within the 262,144 available!

--------------------------------------------------------------------------------

4.2.2 How do I change them?

To use one of your new-found colors is very simple. Simply choose a color ATTRIBUTE to replace with your new color VALUE.

Like this... PALETTE Color_To_Replace%, RGB_Value!

Where, Color_To_Replace% is the Attribute and, RGB_Value! is the Value.

Example, (Replace color attribute 5, magenta, with a value of 1572894, a color that looks like a red-violet on my monitor...

PALETTE 5, 1571894

There is another faster but yet more complicated way to change the RGB values right in the VGA itself. To see how that is done, download my Palette Fader routines from the files section.

--------------------------------------------------------------------------------

MORE ... Later

-------------------------------------------------------------------------------

MS-DOS BATCH PROGRAMMING

INFORMATION ON BATCH FILES

BATCH FILE ABCs

Batch files are programs that allow MS-DOS and Windows users to create a file to perform a long tasks fast. Such as opening certain programs ran frequently, deleting or managing files, etc. Simple batch files do not require any special programming skills and usually can be done by knowing the below commands and or just DOS commands.

A prime example of a batch file for someone whom may know more about Windows or MacOS would be relating a batch file to a shortcut in Windows or icon on a MacOS. Batch files like a shortcuts are small file which is used to run frequently accessed programs.

Another example of a very well known batch file is the autoexec.bat, which is simply a boot file loaded each time the computer is loaded. Within this file contains various lines to load various programs and drivers into memory each time the computer boots.

CREATING A BATCH FILE

To create a basic batch file first open a MS-DOS command prompt and follow the below instructions:

At the MS-DOS prompt type edit test.bat and press enter.
If typed properly you should now be in a blue screen within the blue screen type:
pause
dir c:\windows
dir c:\windows\system
Once the above three lines have been typed in the blue screen choose file and choose exit, when prompted to save click yes
Once you are back at the MS-DOS prompt type test. When enter is pressed, this should execute the test.bat file and begin running the file. Because the first line is pause you will first be prompted to press a key. Once you press a key the batch file will run line by line in this case listing the files in the windows and windows\system directory.
If you wish to add more lines to this batch file you would simply type "edit test.bat" to edit the file again.

BATCH COMMANDS

Just like all MS-DOS commands when creating batch files the lines are not case sensitive. However, in the below listing we have listed all commands in all caps to help you identify which text is a batch file command.

@ Does not echo back the text after the at symbol. This is most commonly used as @ECHO OFF to prevent any of the commands in the batch file from being displayed just the information needed.
%1 The percent followed by a numeric value, beginning with one, allows users to add variables within a batch file. The following is a batch file example:
echo Hello %1
When the above one line batch file is created and adding your name after the batch file. For example typing myname (being the name of the bat file) and then your name:
myname bob
would output
Hello bob

:LABEL By adding a colon in front of a word such as LABEL you create a category, more commonly known as a label. This allows you to skip to certain sections of a batch file such as the end of the batch file. Also see GOTO.

CALL This is used to run another batch file within a batch file. When the batch file that is called is completed the remainder of the original batch file is completed. Note if the batch file does not exist it will give an error message.

CHOICE See running different programs for example of how to use this command.

CLS Just like the DOS command would clear your screen.

ECHO Will echo a message in the batch file. Such as "ECHO Hello World" will print Hello World on the screen when executed. Note if you have not typed @ECHO OFF at the beginning of the file this will also print "ECHO Hello World" and "Hello World". If you would just like to create a blank line type ECHO. adding the period creates an empty line.

EXIT Exits out of the DOS window if the batch file is ran from Windows.

GOTO LABEL Used to go to a certain label such as LABEL. An example of GOTO would be to

GOTO END. For an Example of this see running different programs.

IF Used to check for a certain condition if the condition exists. If that condition exists it will perform that function.. To see an example of this see running different programs.

PAUSE Prompt the user to press any key to continue.

REM Allows you to place comments into the batch file without displaying or executing that line when the batch file is ran.

SHIFT Changes the position of replaceable parameters in a batch program. You can use this command only in batch programs.

START Used for Windows 95, Windows 98, and Windows NT 4.0 and above to start a windows application such as START C:\WINDOW\CALC would run the Windows Calculator. Users running Windows 3.x need to utilize the WIN command. For example WIN C:\WINDOWS\CALC.EXE would run Windows and then Calculator after Windows has finish loading.

BATCH FILE EXAMPLES

Running different programs
Deleting files in directory without prompt
How to start Windows 95 / 98 files from batch file
Creating a batch file delay
How to make time log

RUNNING DIFFERENT PROGRAMS

The following is a simple example of how you can implement the choice options into your batch files. Each line that is in red can be left out of the batch file. They have been included to help explain some of what the batch file means.

@ECHO OFF
REM - LABEL INDICATING THE BEGINNING OF THE DOCUMENT.
:BEGIN
CLS
REM - THE BELOW LINE GIVES THE USER 3 CHOICES (DEFINED AFTER /C:)
CHOICE /N /C:123 PICK A NUMBER (1, 2, or 3)%1
REM - THE NEXT THREE LINES ARE DIRECTING USER DEPENDING UPON INPUT
IF ERRORLEVEL ==3 GOTO THREE
IF ERRORLEVEL ==2 GOTO TWO
IF ERRORLEVEL ==1 GOTO ONE
GOTO END
:THREE
ECHO YOU HAVE PRESSED THREE
GOTO END
:TWO
ECHO YOU HAVE PRESSED TWO
GOTO END
:ONE
ECHO YOU HAVE PRESSED ONE
:END

HOW TO START APPLICATIONS FROM A BATCH FILE

To run files for Windows 95 or Windows 98 in a batch file you would use the START command. The following example would run Windows Notepad.

START /M "C:\WINDOWS\NOTEPAD.EXE"

The /m representing it to start the window Maximized.

CREATING A BATCH FILE DELAY

The following is an example of how to delay a batch file any where from 5 to 99 seconds. In the below example we illustrate a 5 second delay.

TYPE NUL | CHOICE.COM /N /CY /TY,5 >NUL

Additionally you could use the sleep file found on our utility download section.

HOW TO MAKE A TIME LOG

In the following example you will have the capability of creating a time log of when the batch file is loaded or for example in the autoexec.bat when someone logs into a computer.

ECHO. |TIME > TIME
COPY LOG +TIME

An alternate slightly more complicated method that to our knowledge cannot be used in Windows NT, Windows 2000 or Windows ME would be the following:

echo @prompt set date=$d$_set time=$t$h$h$h > {a}.bat
%comspec% /e:2048 /c {a}.bat > {b}.bat
for %%v in ({b}.bat del) do call %%v {?}.bat
echo %date% %time% >> log

For the above batch file to work properly you must create a file called log by typing "edit log" (without the quotes) and then save an exit the file which will create the file at 0 bytes. If this file is not created or not created properly you will receive the error message "Content of destination lost before copy".

How to restart the computer with a batch file:
It may be necessary after a batch file is completed its copying or installing process to restart the computer to complete that installation.

Solution:

MS-DOS

If the computer needs to be restarted from MS-DOS please see our debug page for additional information on how to do this.

Windows

If the computer needs to be restarted from Windows 98 within the batch file type:

START C:\WINDOWS\RUNDLL.EXE user.exe,exitwindowsexec
EXIT

When typing the above two lines spacing is important. It is also very important that the exit line be placed into the batch file as Windows cannot exit the window unless it is specified.

Additionally you may also type the following line in:

rundll32.exe shell32.dll,SHExitWindowsEx n

Where n is equal to one of the following numbers for the proper action.

0 - LOGOFF
1 - SHUTDOWN
2 - REBOOT
4 - FORCE
8 - POWEROFF

Wednesday, January 2, 2008

Run Commands..

WINDOWS XP RUN COMMANDS
RUN SHORTCUTS
------------------------------------------





StartMenu -> RUN -> Type "Run Command" the press Ok (MOUSE)
or
WinKey + R -> RUN -> Type "Run Command from list below" -> Press Enter (Keyboard)

[SOME MOSTLY USED SYSTEM FOLDERS]

All Users Profile %allusersprofile%
Desktop Folder(Current User) desktop
Favourites Folder favorites
Fonts Folder fonts
My Documents Folder my documents
Printers Folder printers
Recently Used Files Folder recent
Start Menu Folder start menu
Send To Folder sendto
Temporary Files %temp%
Themes Parent Folder resources
User Profile Directory %userprofile%
Wallpaper Parent Folder web
Windows Installation Directory %systemroot%

[SYSTEM, LOGOFF, SHUTDOWN]

Command Prompt cmd
Logs You Out Of Windows logoff
Shuts Down Windows shutdown

[GENERAL APPLICATIONS]

Calculator calc
Mcft Chat winchat
Microsoft Paint ms-paint
Ms-Access (If Installed) msaccess
Ms-Excel(If Installed) excel
Ms-Frontpage(If Installed) frontpg
Ms-Outlook Express (If Installed) outlook
Ms-Powerpoint (If Installed) ppoint
Ms-Word (If Installed) winword
Notepad notepad
On Screen Keyboard osk
Sound Reorder sndrec32
Volume Controller sndvol32
Wordpad write
Windows Media Player wmplayer



[WINDOWS DEFAULT GAMES]

Free Cell Card Game freecell
Hearts Card Game mshearts
Minesweeper Game winmine
Spider Solitare Card Game spider

[SOME WINDOWS UTILITIES]

Character Map charmap
Check Disk Utility chkdsk
Clipboard Viewer clipbrd
Disk Cleanup Utility cleanmgr
Disk Partition Manager diskpart
Dr. Watson System Utility drwtsn32
Iexpress Wizard iexpress
Object Packager packager
Performance Monitor perfmon
Private Character Editor eudcedit
Registry Editor regedit
Registry Editor regedit32
Remote Desktop mstsc
System Configuration Editor sysedit
System Configuration Utility msconfig
Task Manager taskmgr
Telnet Client telnet
Utility Manager utilman
Windows Magnifier magnify
Windows System Security Tool syskey
Windows Update Launches wupdmgr
Windows XP Tour Wizard tourstart


[CONTROL PANEL RUN COMMANDS]

Accessibility Controls access.cpl
Add Hardware Wizard hdwwiz.cpl
Add/Remove Programs appwiz.cpl
Administrative Tools control admintools
Automatic Updates wuaucpl.cpl
Date and Time Properties timedate.cpl
Desktop Control Panel desk.cpl
Direct X Control Panel (If Installed)* directx.cpl
Display Properties control desktop
Display Properties desk.cpl
Display Properties control color
Folders Properties control folders
Fonts control fonts
Game Controllers joy.cpl
Internet Properties inetcpl.cpl
Keyboard Properties control keyboard
Mouse Properties control mouse
Mouse Properties main.cpl
Network Connections ncpa.cpl
Network Connections control netconnections
Network Setup Wizard netsetup.cpl
ODBC Data Source Administrator odbccp32.cpl
Password Properties password.cpl
Phone and Modem Options telephon.cpl
Power Configuration powercfg.cpl
Printers and Faxes control printers
Regional Settings intl.cpl
Scanners and Cameras sticpl.cpl
Scheduled Tasks control schedtasks
Security Center wscui.cpl
Sounds and Audio mmsys.cpl
Startup Manager startup.cpl
System Properties sysdm.cpl
User Account Management nusrmgr.cpl
Windows Firewall firewall.cpl
Windows User Manager nusrmgr.cpl

[MANAGEMENT SERVICES]

Certificate Manager certmgr.msc
Computer Management compmgmt.msc
Device Manager devmgmt.msc
Disk Defragment dfrg.msc
Disk Management diskmgmt.msc
Event Viewer eventvwr.msc
Group Policy Editor (XP Prof) gpedit.msc
Indexing Service ciadv.msc
Local Security Settings secpol.msc
Local Users and Groups lusrmgr.msc
Performance Monitor perfmon.msc
Removable Storage ntmsmgr.msc
Removable Storage Operator Requests ntmsoprq.msc
Services services.msc
Shared Folders fsmgmt.msc
Windows Management Infrastructure wmimgmt.msc

[IP CONFIGURATION UTILITY]

IP Configuration (Display Connection Configuration) ipconfig /all
IP Configuration (Display DNS Cache Contents) ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents) ipconfig /flushdns
IP Configuration (Release All Connections) ipconfig /release
IP Configuration (Renew All Connections) ipconfig /renew
IP Configuration (Refreshes DHCP & Re-Registers DNS) ipconfig /registerdns
IP Configuration (Display DHCP Class ID) ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID) ipconfig /setclassid

[OTHERS]

Bluetooth Transfer Wizard fsquirt
Component Services dcomcnfg
DDE Shares ddeshare
Direct X Troubleshooter dxdiag
Driver Verifier Utility verifier
File Signature Verification Tool sigverif
SQL Client Configuration cliconfg





RUN BABY RUN!


Tuesday, January 1, 2008

Remove Autorun Virus : Simple Approach

Make following FILES in your Desktop, be sure of the extensions. Now when you insert your removable drive. Just don't open it.

Select these all files -> Right Click -> Send To -> Removable Drive Letter.

Replace Files ? Dialog May Appear if your removable drive is infected by virus.

autorun.bat
autorun.bin
Autorun.exe
Autorun.ico
AUTORUN.INF
Autorun.ini
autorun.reg
autorun.srm
autorun.txt
autorun.vbs
autorun.wsh
autorun.zip
Autorun.~ex
bittorrent.exe
MFC32DLL.dll.vbs
ms32.dll.vbs
MS32DLL.dll.vbs
msvcr71.dll
RavMon.exe
sal.xls.exe


The virus files would be replaced by these 0 Bytes files. Hence no effect of virus on your computer.