phillip Posted January 5, 2005 Posted January 5, 2005 Hi I Have a separate .exe file that I need to run with an configuration file from vb.net. I can run it fine manually by Opening the .CFG file with the Application. (using the "openwith" then selecting the app) How can I do this from code? I tried this but it didn�t work Dim pProcess As New Process Dim pProcessInfo As New ProcessStartInfo pProcessInfo.FileName = "D:\Tools\test.exe" pProcessInfo.Arguments = "D:\Tools\config.CGF" pProcessInfo.UseShellExecute = True pProcess.StartInfo = pProcessInfo pProcess.Start() Quote phillip Restall
Himo Posted January 5, 2005 Posted January 5, 2005 a .config or .cfg file in .net is XML-based so you can use the System.XML.XmlTextReader to read it out.(But I prefer the XmlDocument with XmlNodeList) Quote For questions about VS .net extensibility, please fire at me! :) For readability, please use the [ CS][/CS ] tags
phillip Posted January 5, 2005 Author Posted January 5, 2005 Thanks for the reply but i think you misunderstood me. I need to open the config.cgf file using the test.exe the config.cgf file tells the test.exe what to do. Quote phillip Restall
Administrators PlausiblyDamp Posted January 5, 2005 Administrators Posted January 5, 2005 Does the test.exe allow you to specify a command line parameter? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
phillip Posted January 6, 2005 Author Posted January 6, 2005 Does the test.exe allow you to specify a command line parameter? No it doesn't. I might have to get the company to change the way it works. At the moment i write the .cgf file from my application then need to run the test.exe and some how associate the two files. (Like the open with in folders) I'll see if the can get them to use a standard name for the .cgf and do it at there end so i only have to run the test.exe and nothing else. Quote phillip Restall
sgt_pinky Posted January 6, 2005 Posted January 6, 2005 If test.exe doesnt accept a parameter, then you can't do it. Associating files works by passing parameters, so you can't do that either. Making the cgf a standard name won't fix anything - you have to get them to change the app. Do you know the company? What is the app made with? Quote
phillip Posted January 6, 2005 Author Posted January 6, 2005 (edited) If test.exe doesnt accept a parameter, then you can't do it. Associating files works by passing parameters, so you can't do that either. Making the cgf a standard name won't fix anything - you have to get them to change the app. Do you know the company? What is the app made with? I Just Checked and found that the program does except a parameter. Its is the Path of the .CGF file How do i get the .exe file to take the parameter? Edited January 6, 2005 by phillip Quote phillip Restall
sgt_pinky Posted January 6, 2005 Posted January 6, 2005 How do i get the .exe file to take the parameter? Exactly how you have done it above, except change the very last line to: pProcess.Start(pProcessInfo) You may want your calling application to block until the spawned process has completed. If this is the case, use: pProcess.Start(pProcessInfo) pProcess.WaitForExit() ' 'Any code here won't happen until the spawned app has exited ' ;) Quote
donnacha Posted January 10, 2005 Posted January 10, 2005 Can you not just add parameters to your .config file and then use them to tell the appp what to do, it would probably be easier Quote Hamlet
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.