Click here to Skip to main content
15,903,012 members
Home / Discussions / C#
   

C#

 
QuestionSending info to command line Pin
ddpn4215-Jun-06 8:47
ddpn4215-Jun-06 8:47 
AnswerRe: Sending info to command line Pin
Alexander Wiseman15-Jun-06 8:54
Alexander Wiseman15-Jun-06 8:54 
GeneralRe: Sending info to command line Pin
Josh Smith15-Jun-06 9:02
Josh Smith15-Jun-06 9:02 
GeneralRe: Sending info to command line [modified] Pin
ddpn4215-Jun-06 9:21
ddpn4215-Jun-06 9:21 
GeneralRe: Sending info to command line Pin
Alexander Wiseman15-Jun-06 9:25
Alexander Wiseman15-Jun-06 9:25 
GeneralRe: Sending info to command line Pin
ddpn4215-Jun-06 10:02
ddpn4215-Jun-06 10:02 
GeneralRe: Sending info to command line Pin
Dustin Metzgar15-Jun-06 10:15
Dustin Metzgar15-Jun-06 10:15 
AnswerRe: Sending info to command line [modified] Pin
Alexander Wiseman15-Jun-06 10:23
Alexander Wiseman15-Jun-06 10:23 
I just tried using the Arguments property to call a batch file using the command shell (cmd.exe) and it worked. I think your problem may be in your command line arguments. Do you prefix the path to your batch file with the /C switch? If you look at the help for "cmd.exe" (you can do this by going Start > Run and typing: "cmd.exe /?"), you need the /C switch to execute a command with the shell.

For instance, if I have a batch file called "simple.bat" on the C: drive, then this command (even at the command prompt or the run dialog) will not run the batch file:

cmd.exe "C:\simple.bat"

Rather, you must enter the command this way:

cmd.exe /C "C:\simple.bat"

Thus, your Arguments property should look like this:

process.StartInfo.Arguments = "/C \"C:\\simple.bat\""

If you do not have the /C switch in there, then when you call the process cmd.exe, it will ignore your batch file argument. Let me know if that works.

Sincerely,
Alexander Wiseman

-- modified at 16:25 Thursday 15th June, 2006

[EDIT]

EricDV has posted a much quicker way of opening a batch file in his response below. However, if you positively need to do it with cmd.exe, then I think you'll need the /C switch.

[/EDIT]
AnswerRe: Sending info to command line Pin
Dustin Metzgar15-Jun-06 9:01
Dustin Metzgar15-Jun-06 9:01 
GeneralRe: Sending info to command line Pin
Dustin Metzgar15-Jun-06 9:05
Dustin Metzgar15-Jun-06 9:05 
AnswerRe: Sending info to command line Pin
Eric Dahlvang15-Jun-06 10:14
Eric Dahlvang15-Jun-06 10:14 
GeneralRe: Sending info to command line Pin
ddpn4215-Jun-06 10:53
ddpn4215-Jun-06 10:53 
AnswerRe: Sending info to command line [modified] Pin
Eric Dahlvang15-Jun-06 11:16
Eric Dahlvang15-Jun-06 11:16 
GeneralRe: Sending info to command line [modified] Pin
ddpn4216-Jun-06 4:31
ddpn4216-Jun-06 4:31 
QuestionCLR Integration. Pin
PrashantJ15-Jun-06 8:26
PrashantJ15-Jun-06 8:26 
AnswerRe: CLR Integration. Pin
Josh Smith15-Jun-06 8:33
Josh Smith15-Jun-06 8:33 
QuestionPanel contrrol are not removing correctly Pin
Ista15-Jun-06 7:39
Ista15-Jun-06 7:39 
AnswerRe: Panel contrrol are not removing correctly Pin
Josh Smith15-Jun-06 8:03
Josh Smith15-Jun-06 8:03 
GeneralRe: Panel contrrol are not removing correctly Pin
Ista15-Jun-06 8:57
Ista15-Jun-06 8:57 
QuestionSerialPort class and opening ports Pin
Member 76109415-Jun-06 6:07
Member 76109415-Jun-06 6:07 
Questionpreventing header in xml file Pin
Yustme15-Jun-06 6:01
Yustme15-Jun-06 6:01 
AnswerRe: preventing header in xml file Pin
Dustin Metzgar15-Jun-06 6:19
Dustin Metzgar15-Jun-06 6:19 
GeneralRe: preventing header in xml file Pin
Dustin Metzgar15-Jun-06 6:34
Dustin Metzgar15-Jun-06 6:34 
GeneralRe: preventing header in xml file Pin
Yustme15-Jun-06 6:55
Yustme15-Jun-06 6:55 
GeneralRe: preventing header in xml file Pin
Dustin Metzgar15-Jun-06 6:59
Dustin Metzgar15-Jun-06 6:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.