I am trying to write a code that will launch the MSDOS prompt from windows and input a pre-set command line when i click a button, but am having trouble trying to find a proper way of getting it to work, if anyone could help me out, i would greatly appreciate it.

Recommended Answers

All 3 Replies

Lanching MSDOS you should have been able to do, the problem is sending commands to it - this is a standard issue - normal way to do it is to either:

Do a lot of fancy work with copy and paste to a window handle you find by name, or by process ID

or

You can use something like http://www.delphi3000.com/articles/article_2298.asp

GOOGLE IS YOUR FRIEND

how can you manage to do that stuff.

Simpler way would be to save the commands to a batch file and then execute it. ( for example using savetofile method of tstrings) and then executing the file with:

ShellExecute( 0,'open', pchar(file_name),nil,pchar(extractfilepath(file_name)),0);

or

WinExec(pchar(file_name),SW_SHOWDEFAULT);
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.