我的代码如下Private Sub Command1_Click()
Shell "c:\1.bat" 注1.bat的内容为ipconfig >c:\1.txt
Open "c:\1.txt" For Input As #1
x$ = Input$(LOF(1), 1)
Text1.Text = x$
Close
End Sub
但出错了,提示输入超出文件末尾,不知道如何解决
Shell "c:\1.bat" 注1.bat的内容为ipconfig >c:\1.txt
Open "c:\1.txt" For Input As #1
x$ = Input$(LOF(1), 1)
Text1.Text = x$
Close
End Sub
但出错了,提示输入超出文件末尾,不知道如何解决
因为vb中认为一个中文字符长度和英文一样都是一,所以会出错了。
建议这样
Open "c:\1.txt" For Input As #1
Do While Not EOF(1)
x$ = x$ & Input$(1, 1)
Loop
Text1.Text = x$
Close