I am writing a small disk management program. I would like to be able to call some of the dos functions via my program. But the dos functions sometimes ask for arguments, such as 'are you sure?', and then one needs to type in 'y'.
I have seen that one can create a response.tmp file, that contains the arguments to pass to the dos program. i,e
Private Sub Form_Load()
x = Shell("format a:\ < c:\response.tmp", SW_HIDE)
Now this dos command works when I type it in dos, it formats the disk automatically.
But when I try to execute the dos command in my VB
program, I get the error, file not found. I have heard something about a WinExec function, but am not sure how to use it... take the following code
Declare Function WinExec Lib "Kernel" (ByVal lpCmdFile As String, ByVal
fuCmdShow As Integer) As Integer
How do I place this in my code, wherever I place this code, VB
gives me an error.