Opening other files

darryl14

New member
Joined
Feb 23, 2005
Messages
4
Programming Experience
Beginner
right... what i want to do is click a button and it run another file that is already on the harddisk, how can i do this? Could someone please post some sample code. I dont know if its relevant but the files i want to run are batch files. Thankyou.
 
Use : process.start("File name")
If your batch files have arguments you can use them as well like this : process.start("File name", "Args")

TPM
 
or use an OpenFileDialog to have the user select a file to be opened then you can use a streamreader and whatnot to actually open/manipulate the file contents
 
right... im not sure that the process.start() works, how would it work with a batch file

say the file were in C:\batchfile1.bat for simplicitys sake. How would i go about running this file. Would it go some thing like:

process.start(batchfile1.bat)

or is it more complex, because i just tried something like that and it said that batchfile1 is not declared. What do i need to do.
 
shell(batchfile1.bat) would work as well or system.diagnostics.process.start(batchfile1.bat) would also work
 
VB.NET:
Private Sub btnRunBatch (...) Handles btnRunBatch.Click
   Shell("batchfile1.bat", AppWinStyle.NormalFocus)
End Sub
 
Back
Top