Click here to Skip to main content
15,886,801 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am unable to run the .bat file. I tried all possible ways of executing bat file.
I have one .bat file inside that batch file i have one .exe file and config file(.ini file).
When i click the button i want that particular .bat has to get executed i.e exe file should execute.
when i execute process.start(batfilepath), it is reading the content inside bat file showing exe and ini file and popping message .exe in not internal or external command.
when i used process.startinfo nothing is done..

Could any one please help...
Posted
Comments
OriginalGriff 5-May-12 3:16am    
Show us the code you tried, and the batch file you used - relevant code fragments only, please!
Use the "Improve question" widget to edit your question and provide better information.

HI
try this

VB
Dim ps As New ProcessStartInfo("cmd.exe")
ps.Arguments = "yourbatfile.bat"
Process.Start(ps)
 
Share this answer
 
Comments
VJ Reddy 5-May-12 4:59am    
Good answer. 5!
thams 5-May-12 5:45am    
Thanks
Maciej Los 5-May-12 5:05am    
5 of course!
thams 5-May-12 5:45am    
thankyou
Manoj Kumar Choubey 5-May-12 7:12am    
+5 Nice
If you would like to start *.bat or *.exe file from commandline, you need to define full path and name to this file.
When you run cmd.exe it shows:
C:\Windows\system32.exe - title of command window
C:\Documents And Setting\your_username>_ - inside command window.
When you trying to execute blablabla.bat and blablabla.bat is not in this folder, nothings happend.

To execute any executable file from commandline, use:
plain
C:\Documents And Setting\your_username>rem cmd is waiting for your command 
C:\Documents And Setting\your_username>chdir "path_to_bat" 
path_to_bat>short_file_name.bat 
path_to_bat>rem that's all 


Do you understand now?

You can call this *.bat using Shell function[^] too.
 
Share this answer
 
Comments
VJ Reddy 5-May-12 4:59am    
Good answer. 5!
Maciej Los 5-May-12 5:03am    
Thank you, VJ ;)
Manoj K Bhoir 5-May-12 5:18am    
MY 5!
Maciej Los 5-May-12 16:20pm    
Thank you, Manoj ;)

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