Write program that uses MS-DOS?

This is a discussion on Write program that uses MS-DOS? within the C Programming forums, part of the General Programming Boards category; How would you go about writing a program that uses MS-Dos. Ex. I wanted to open up command prompt and ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    7

    Write program that uses MS-DOS?

    How would you go about writing a program that uses MS-Dos.

    Ex. I wanted to open up command prompt and input the command "Start /separate e:\example.exe".

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    Use CreateProcess().

    CreateProcess Function (Windows)

  3. #3
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,831
    Start -> Run and enter "CMD". That starts a DOS window. Then type the line you want.

    I think that's what you're asking. To write a program, just compile a "Console Application" or something like that. It will create an .exe file. You probably want it to be called Start.exe according to your example.

  4. #4
    Registered User
    Join Date
    Mar 2010
    Posts
    7
    I think I may have explained that wrong. I was rather vague. I am thinking of a C program that would open up ms dos and input commands, rather then a user input. Im being vague because I generally don't know anyway to do this. Here's a better example.


    ex.

    1.) User compiles code
    2.) Executes
    3.) The program opens up command prompt
    4.) It (not the user) enters "copy /y c:\example.txt c:\exfolder"
    5.) Text file is copied from c: to the folder 'exfolder'
    6.) Program executed successfully, it closes.

  5. #5
    Registered User
    Join Date
    Mar 2010
    Posts
    7
    I found what I was looking for. It was the system() function. Thank you for your patience

  6. #6
    Registered User
    Join Date
    Jun 2010
    Location
    Guangdong,China
    Posts
    2
    hello.Cgrassshopper.
    yes, it's system() function that you are looking for.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Double Buffer my DOS program??
    By Yarin in forum C++ Programming
    Replies: 6
    Last Post: 09-10-2007, 10:58 PM
  2. Newbie needs help..
    By xpress urself in forum C++ Programming
    Replies: 3
    Last Post: 07-26-2007, 07:22 PM
  3. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  4. Some humour...
    By Stan100 in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 11-06-2003, 09:25 PM
  5. The Timing is incorret
    By Drew in forum C++ Programming
    Replies: 5
    Last Post: 08-28-2003, 04:57 PM

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