Thread: How do you run a program from the command prompt?

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663

    How do you run a program from the command prompt?

    Hi,

    I opened up a DOS window(Start->Programs->MSDOS prompt) and the program I want to run is named text.exe and it's in this directory:

    C:\Beginning C++\test\Debug

    I used

    cd C:\

    to get to the C:\> prompt, but when I tried to do this:

    C:\>cd Beginning C++\test\Debug
    Too many parameters - C++\test\Debug

    I got that error. I think the space in the "Beginning C++" directory is causing problems. What should I do?

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Never mind: quote marks.

    cd "Beginning C++\test\Debug"

  3. #3
    jasondoucette.com JasonD's Avatar
    Join Date
    Mar 2003
    Posts
    278
    Just a note, the command prompt from WinXP doesn't have this problem. It works fine without the quotes.

  4. #4
    Registered User slaveofthenet's Avatar
    Join Date
    Apr 2003
    Posts
    80
    cd beginn~1\test\Debug

    That's a shortcut for identifying long file/directory names.
    Detailed understanding of language features - even of all features of a language - cannot compensate for lack of an overall view of the language and the fundamental techniques for using it. - Bjarne Stroustrup

  5. #5
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Not very portable though. What if there's a directory called 'Beginning C'? Then you'd have to reference 'Beginning C++' as 'Beginn~2'.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  6. #6
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    this if the "formula" you would use (if you didn't get it from the previous examples:

    [first six letters]~[number of files with same first 6 letters, starting at 1].[three char extension]

    for example:

    longfilenameC.cpp
    longfilenameC++.cpp

    would be:

    longfi~1.cpp
    longfi~2.cpp

    in that order...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  3. Re-doing a C program to run in Win2000 or XP
    By fifi in forum C Programming
    Replies: 5
    Last Post: 08-17-2007, 05:32 PM
  4. Replies: 3
    Last Post: 07-11-2005, 03:07 AM
  5. plz help me run this program!!!
    By galmca in forum C Programming
    Replies: 8
    Last Post: 02-01-2005, 01:00 PM