How can I make an .exe that will execute a dos command?

Sir Fredrick

Guest
Oct 14, 1999
4,375
0
0
Your question is too vague. But if you have a program written in C++ and you want it to call another program or run a dos command, I believe shellex("whateveryourcommandisgoeshere") will do the trick.
 
Jun 18, 2000
11,197
769
126
Are you coding this in C++? If so, there is a system() function that allows you to pass a text string to be executed by ms-dos. It works something like this:

1) Declare a string variable to hold your dos command.
apstring myVariable;

2) Store your dos command into myVariable.
myVariable = "copy c:\\winnt\\filename.txt c:\\filename.txt";

3) Pass your variable to the system function.
system(myVariable.c_str());

Note, the system function doesn't take apstring's. The .c_str() converts the apstring to a C-style string.
 

BadNewsBears

Diamond Member
Dec 14, 2000
3,426
0
0
Well see I cant program (just html and a lil java). SOmeone wanna send me an exe that will open a dos command. ANd I can open it with notepad, hexworkshop and tell it to run certain command?
 

Jeffwo

Platinum Member
Mar 2, 2001
2,759
0
76


<< <<< Batch files. >>> >>



Whatever that means...lol

Did you ever get an exe from someone?

I am still trying to figure out a webpage to get my pics posted on.

Jeff
 

cjchaps

Diamond Member
Jul 24, 2000
3,013
1
81
Ummm... back in the day I used a program called bat2exe.exe or something. There are also bat2com.exe files to convet to .com files. If you convert to .com, just rename it to a .exe and it will work the same way.
 

Czar

Lifer
Oct 9, 1999
28,510
0
0


<<

<< <<< Batch files. >>> >>

>>





create a text file
call it runthiscrap.bat

open notepad and edit it
add

dir c: /s |more

Run bat file