I am writing a small shell script for windows just for fun and was wondering how to open executable programs? Can c++ do this?
Sturm
270
Veteran Poster
Recommended Answers
Jump to PostC++ can do anything which you could do from the command prompt, using the system() function - eg, (Assuming some version of DOS or Windows)
system("dir"); //DOS Command to show a directory listing system("pause"); //DOS command to make a pause happen
Jump to PostYup, use the system() command. For example:
system("DIR C:\");
lists the contents of the C:\ drive. Simply enter in the path of the script, and you're good to go.
Hope this helps
[edit]Too slow...[/edit]
Jump to PostYup, use the system() command. For example:
system("DIR C:\");
lists the contents of the C:\ drive. Simply enter in the path of the script, and you're good to go.
Hope this helps
[edit]Too slow...[/edit]
Presumably you meant
system("DIR C:\\");
Jump to PostPresumably you meant
system("DIR C:\\");
I forgot! My bad. I guess it's because I'm so used to using forward slashes for Unix that I forgot about the needed escape charecter under Windows. But I heard somewhere that you can still use forward slashes in C++ programs under Windows; …
All 14 Replies
Bench
212
Posting Pro
John A
1,896
Vampirical Lurker
Team Colleague
dwks
149
Posting Whiz in Training
Sturm
270
Veteran Poster
John A
1,896
Vampirical Lurker
Team Colleague
Bench
212
Posting Pro
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
Bench
212
Posting Pro
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
Sturm
270
Veteran Poster
Ravalon
62
Posting Whiz in Training
Bench
212
Posting Pro
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
John A
1,896
Vampirical Lurker
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.