Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to pass parameters to command prompt in mfc?
Posted

(Not sure I got you) You may use the system[^] function (or ShellExecute[^] or CreateProcess[^]).
 
Share this answer
 
Comments
Orjan Westin 31-Oct-14 11:32am    
Could possibly mean "pass back to command prompt", which would mean using std::out or printf.
I think he wants to start a Windows application using command line arguments. In that case he could try this

VB
Dim arg As String()
        arg = Environment.GetCommandLineArgs()
        For i As Integer = 1 To arg.Length - 1
            Select Case arg(i).ToLower
                Case "a"
                    'Insert code here
                Case "b"
                    'Insert code here
                Case "c"
                    'Insert code here
                Case Else
                    MessageBox.Show("Unknown argument " & arg(i) & ". Programm starts without arguments", "Oops")                    
            End Select
        Next
 
Share this answer
 
Comments
Nitin R G 3-Nov-14 6:27am    
Using Create Process, only commands can be passed..but not application path rite???
Blutfaust 3-Nov-14 14:14pm    
This example starts an application with a simple argument, assumed it is put into the Form.Load-Event.

e.g.

"C:\application.exe a" starts the application and runs the code found in 'Case "a"'

"C:\application.exe d" starts the application and shows the MessageBox as it runs into "Case Else"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900