Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a batch file from a VB project

Status
Not open for further replies.

jbrowne

Programmer
Feb 1, 2000
182
IE
Hi,

I am running the function below to run a batch file from a specific directory using my VB project. This code has worked fine on Windows 98, 2000, NT etc but when run on Windows XP it seems to have a problem. Instead of looking in the correct directory for the .bat file (which is stored in the variable 'docname' - it automatically looks for the file on the root directory (which seems to be the default in the parameters). Has anyone eles experienced anything like this with XP or have any solution for me.

Thanks in advance,
John B


Public Function StartDoc(DocName As String, Parameter As String) As Long
Dim Scr_hDC As Long
Scr_hDC = GetDesktopWindow()
Dim AllocDocName As String

AllocDocName = Space$(200)

AllocDocName = DocName

StartDoc = ShellExecute(Scr_hDC, "Open", AllocDocName, Parameter, "C:\", SW_SHOWNORMAL)
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top