Just a Quick Question

This is a discussion on Just a Quick Question within the C++ Programming forums, part of the General Programming Boards category; I'm pretty sure this is a question that's pretty common...and it has to do with spaces in file names when ...

  1. #1
    People Love Me
    Join Date
    Jan 2003
    Posts
    412

    Just a Quick Question

    I'm pretty sure this is a question that's pretty common...and it has to do with spaces in file names when asking DOS to run a program.

    ...What can I use in place of the space? I tried a "%20" and even Alt+255, but no such luck.

    Also, is there any other DOS command other than 'start' to execute programs? I'm not exactly well-versed in the ways of using DOS.

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    If it's true DOS, you cannot have spaces in filenames. You might be using a shell, such as the command prompt inside Windows. In that case, you can just put a space in the string.

    To run a program in DOS, you just type the name of the program.

  3. #3
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    well, if you're trying to run run this program.exe in DOS, you would reference it as runthi~1.exe, and if you had two things with similar names, e.g. run this program.exe and run this program number two.exe, you would reference the first one the same way I already told you, and the second one would be referenced like: runthi~2.exe.

    a pretty standard character used to replace spaces is the underscore ('_')
    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

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    ...What can I use in place of the space? I tried a "%20" and even Alt+255, but no such luck.
    You're trying to type-in a program name with a space? Try putting quotes around everything like this:
    "C:\My Programs\HelloWorld.exe"

    Also, is there any other DOS command other than 'start' to execute programs?
    You can navigate to the program using Windows Explorer and ust double-click it.

    Beware of the Window automatically closing problem.

    What operating system are you using? With Win98 you can open a DOS Window: Start->Programs->MS DOS Prompt. With Win2K, and XP I think it's called "Command Prompt"... and I don't remember how you get there from "Start". Of course, you can put a shortcut on your desktop.

    Once you're in DOS, or the command prompt, you may have to use the Change directory (change folder) command to get into the folder where your program resides:

    CD "C:\My Programs\MyCPP"

    Two dots will take you "up" one level: CD..

    You might try to look-up "DOS commands" on the net. I have a big fat antique "Using DOS" book.

    EDIT -
    Also, look-up the doskey command. It saves a lot of re-typing. See if you can find something on writing DOS batch files. A batch file is a little script... a sequence of DOS comands saved as text (ASCII), with a .bat file extension.

    An example would be:
    CD "C:\My Programs\CPlusPlusPrograms"
    doskey /insert
    Last edited by DougDbug; 01-26-2005 at 06:49 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Very quick math question
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-26-2005, 11:05 PM
  2. very quick question.
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 07-24-2002, 03:48 AM
  3. quick question
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-22-2002, 04:44 AM
  4. Quick Question Regarding Pointers
    By charash in forum C++ Programming
    Replies: 4
    Last Post: 05-04-2002, 11:04 AM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21