![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jul 2008
Posts: 43
OS: Windows Vista Home Premium SP1, Windows XP Professional SP3, Windows 2000 Professional SP4
|
C++ program
Alright. So, I'm writing a small program (runs in a command line interface) to do a variety of tasks, including accessing batch files in sub-directories. The program is meant to be run from a CD-Rom, which contains a number of sub-directories. One such sub-directory contains my batch files (the reason for this is to keep the CD-Rom image from becoming cluttered). My question now is, does anybody know how I can execute this task of calling a batch file from a sub-directory? The command I am using right now works only for batch files that are in the same directory as the main application. The command is as follows:
if (go == 3){ system("go.bat"); break; } I want to (for instance) run this batch file from a sub-directory simply called "Batch". If anyone has any idea how to complete this, I would greatly appreciate any help you could give me. Thanks. |
|
|
|
|
|
#2 (permalink) |
|
TSF Enthusiast
Join Date: Jul 2007
Location: Northampton, UK
Posts: 911
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: C++ program
Can you use the full path?
Apparently, you use double forward/back-slashes as a folder seperator... e.g. Code:
system("Batch//go.bat");
Jamey
__________________
=] |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Jul 2008
Posts: 43
OS: Windows Vista Home Premium SP1, Windows XP Professional SP3, Windows 2000 Professional SP4
|
Re: C++ program
Thanks for your help, but i've figured it out (and it works)... the resulting
code is as follows (for anyone that cares): Code:
system("Batch\\go.bat");
|
|
|
|
|
|
#4 (permalink) |
|
TSF Enthusiast
Join Date: Jul 2007
Location: Northampton, UK
Posts: 911
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: C++ program
ahh, okay, i didn't know the difference between // and \\ (c++ wise i'm a noob)...
Cheers for posting your solution, Jamey
__________________
=] |
|
|
|
![]() |
| Thread Tools | |
|
|