Monday, May 24, 2010

Does anybody know what the code in Visual Basic is too have it execute a file?

For instance, I want to import a reg text file. So I want VB to execute file.reg and have the registry file import the settings into xp.

Does anybody know what the code in Visual Basic is too have it execute a file?
if it is vb I thnk it is


shell(FileName).





In VB .Net


System.Diagnostics.Process.Start _


("c:\somepath\somefile.txt")
Reply:Use the Run command of the Scripting host Shell Object.





In addition to launching .exes, it can launch document files if you have the proper association for the file type.





Note a syntax difference. Their example uses:


WScript.CreateObject.





In VB, just say


CreateObject


No comments:

Post a Comment