Question Console application help screen?

techwiz24

Well-known member
Joined
Jun 2, 2010
Messages
51
Programming Experience
Beginner
I know with the windows default programs you can add the /? option after the program name and get a nicely formatted help screen. What i have right now is that when the program is called with the /? or -h option, the console simply writes some text. But the problem is that it is all mis-formatted and no longer lined up...any ideas?


here's a snippit of my program. It's open source, if you want to check it out: http://www.sourceforge.com/projects/amake32
VB.NET:
Dim operation_type As String = args(1)
		Select Case operation_type
Case "-h"
				Console.WriteLine("--------------------------------------------------")
				Console.WriteLine("amake32 version 0.5 created by techwiz24 (C) 2010")
				Console.WriteLine("--------------------------------------------------")
				Console.WriteLine("Mode " + args(1) + " [HELP]")
				Console.WriteLine("Usage:  amake32 [Mode: -c -r -d -Ac -h (/?)] [Command (In quotes) If needed] [Name (no spaces)")
				Console.WriteLine("Options:")
				Console.WriteLine("				   -c        Mode Create, allows creation of windows aliases")
				Console.WriteLine("                -r        Mode Read, reads the contents of the windows aliases")
				Console.WriteLine("                -d        Mode Delete, deletes a windows alias, prompts for confirmation first")
				Console.WriteLine("                -Ac       Mode assisted create, uses prompts to assist you with the creation of windows aliases")
				Console.WriteLine("                -h or /?  Mode Help, shows this prompt")
				Console.WriteLine("                [COMMAND] The exact text of the command prompt command. If you need new lines, use the GUI version of the program")
				Console.WriteLine("                [NAME]    The name of the alias, this is the name you will use to call the alias from the command prompt")
			Case "/?"
				Console.WriteLine("--------------------------------------------------")
				Console.WriteLine("amake32 version 0.5 created by techwiz24 (C) 2010")
				Console.WriteLine("--------------------------------------------------")
				Console.WriteLine("Mode " + args(1) + " [HELP]")
				Console.WriteLine("Usage:  amake32 [Mode: -c -r -d -Ac -h (/?)] [Command (In quotes) If needed] [Name (no spaces)")
				Console.WriteLine("Options:")
				Console.WriteLine("				   -c        Mode Create, allows creation of windows aliases")
				Console.WriteLine("                -r        Mode Read, reads the contents of the windows aliases")
				Console.WriteLine("                -d        Mode Delete, deletes a windows alias, prompts for confirmation first")
				Console.WriteLine("                -Ac       Mode assisted create, uses prompts to assist you with the creation of windows aliases")
				Console.WriteLine("                -h or /?  Mode Help, shows this prompt")
				Console.WriteLine("                [COMMAND] The exact text of the command prompt command. If you need new lines, use the GUI version of the program")
				Console.WriteLine("                [NAME]    The name of the alias, this is the name you will use to call the alias from the command prompt")
End Select
 
Last edited:
In first option line (-c) you have Tab chars instead of Space chars.
The other problem is consoles usually have a width of 80 chars, which your lines exceeds and then wrap to next line. Console.BufferWidth is a get/set property.
 
You can either set a width that is wide enough for you, or format your text according to standard console width of 80 chars. Learn more about Console class here Console Class (System)

I use VB Express, I found that way better than SharpDevelop, at least that was the case some years ago.
 
Back
Top