How get the prompt information?
Exemple:
You have a environmental variable called "MYVAR" and its value is "c:\MyFolder\VB"
if you enter "set myvar" at the dos prompt, the windows displays "MYVAR=c:\MyFolder\VB"
HOW can I get the line "MYVAR=c:\MyFolder\VB" with vb code??
This is an example, I know that the Environ function return environmental variables.
But generally, I want to get the prompt returned information (scanf in C...)
Fzz
Re: How get the prompt information?
redirect result to a textfile:
option Explicit
private Sub Form_Click()
Dim sLine as string, Msg as string
' execute command
Shell "command.com /c " & "set > c:\info.txt"
'Shell "command.com /c " & "dir/w > c:\info.txt"
DoEvents
' read file
Open "c:\info.txt" for input as #1
Do While Not EOF(1)
Line input #1, sLine
Msg = Msg & sLine & vbCrLf
Loop
Close #1
MsgBox Msg ' show result
End Sub
Note:
you can add pause after Shell, or you can use some advanced code to ShellAndWait
Re: How get the prompt information?
You can use this function;
Environ({envstring | number})
as in
myVar = environ("MYVAR")