|
-
January 21st, 2000, 09:53 AM
#1
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
-
January 21st, 2000, 12:40 PM
#2
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
-
January 21st, 2000, 02:25 PM
#3
Re: How get the prompt information?
You can use this function;
Environ({envstring | number})
as in
myVar = environ("MYVAR")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|