Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Command line parameters

This topic is 6199 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

A command line parameter is an setting you pass to a program from the command line. For example back it the days of DOS if you typed:


in a directory with thousands of files you couldn''t read the ones at the top because you could only fit about 25 lines on the screen, you could avoid this by giving the /p command line parameter to the program "dir" and it would display a single screen at a time e.g.

C:\>dir /p

Share this post

Link to post
Share on other sites
Command line parameters are parameters that are passed to an executable. For example, "ps -f" tells ps to give the full listing. Or, using halflife... "halflife.exe -console", tells the executable to enable the console in the game.
Implementing command line parameters is easy in c/c++ code.

int main( int argc, char* argv[] )
#include ...

do stuff with the command line parameters
return 1;

argc is the number of parameters received, and argv contains a c-string representation of each of the parameters.

Edited by - DoomX on July 31, 2001 12:30:44 PM

Share this post

Link to post
Share on other sites
Windows programs can be run with command line parameters by just adding them after the filename in the Run dialog, or by creating a shortcut to them and modifying the path. You can make Visual C++ run your program with a command line parameter in the project settings if you want to test out command lines from within VC++.

Getting the command line parameters in a Win32 application is easy. The command line is passed in as an LPSTR when the program starts.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!