On button click in a winform application I am executing cmd.exe file (Using system("cmd.exe");), which opens perfectly fine and displays the following:
Microsoft Windows XP [Version 6.1.7601]
(C) Copyright 1985-2001 Microsoft Corp.
C: A\Documents\Visual Studio 2010\Projects\WinformTest\WinformTest>
What I want is when a user click the button, the cmd.exe open with default command and a message like this:
Please change command options and press enter to get started experimenting
C: A\Documents\Visual Studio 2010\Projects\WinformTest\WinformTest> reduction -x 33554432 -i
Notice a new command and a message is already there.
Can anybody tell me how to go for this?
UPDATE
cmd /k echo Please change command options and press enter to get started
experimenting & echo reduction -x 33554432 -i
This shows closest solution, but here I have to set the commands every time I open the cmd. Is it possible to set the command once and save the setting, so next time I open CMD the message is displayed? Or it is possible to pass these commands options/switches when I am opening it in my application using system("cmd.exe") so that at run time this setting for message is done?
Solved
system("cmd.exe /k echo Please change command options and press enter to get started
experimenting & echo reduction -x 33554432 -i" );
But this echoes maeesage but the command is not comming at the prompt.
