Allowing user selection of directory so program can run .exe files?

This is a discussion on Allowing user selection of directory so program can run .exe files? within the C Programming forums, part of the General Programming Boards category; Hey guys, I got a problem that I really have no idea where to begin. Basically, I'm writing a program ...

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    7

    Allowing user selection of directory so program can run .exe files?

    Hey guys, I got a problem that I really have no idea where to begin.

    Basically, I'm writing a program utility to help create DOS batch files and then it automatically runs the batch files. However, the commands in the batch files require use of an executable program. So how do I let the user select the proper directory of where the executables are located so I can run these exe files? Is it even possible? Just seems really strange to me.

    Thanks for any help. If you need clarification let me know!

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    You could do this a number of ways, but I think your problem description is too vague. What interaction do you want the user to have with the batch files or the utility you are writing? Why can't the path be entered in the utility program or alternatively as an argument to the batch files?

  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    38
    When I compile my C programs, I save it in my personal folder which can be other than DOS.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    If you have your executables in the system path, then it wouldn't matter.

    But in general, whatever you would type on the command line is what goes in the batch file -- so if you had to type "C:\this\that\the other\foo.exe" to run your program, then "C:\this\that\the other\foo.exe" is what needs to go in your batch file.

  5. #5
    Registered User
    Join Date
    Jul 2008
    Posts
    7
    Quote Originally Posted by tabstop View Post
    If you have your executables in the system path, then it wouldn't matter.

    But in general, whatever you would type on the command line is what goes in the batch file -- so if you had to type "C:\this\that\the other\foo.exe" to run your program, then "C:\this\that\the other\foo.exe" is what needs to go in your batch file.
    Can't believe it was that simple. I guess I've been too spoiled of always just going to the directory to run things that I forgot haha. Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c program to print list of files in a directory
    By leo_1024 in forum Linux Programming
    Replies: 3
    Last Post: 01-24-2009, 04:54 AM
  2. Builder C++ large files support for simple C program
    By Murfury in forum C Programming
    Replies: 3
    Last Post: 11-23-2007, 02:47 PM
  3. Check directory program is run from?
    By willc0de4food in forum C Programming
    Replies: 10
    Last Post: 06-29-2005, 02:36 AM
  4. Dos commands hehe
    By Carp in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-17-2003, 01:51 PM
  5. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM

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