比如
用shell()调用了一个DOS命令!
在DOS界面上是有运行结果的!
请问各位高手如何得到这些值啊?
用shell()调用了一个DOS命令!
在DOS界面上是有运行结果的!
请问各位高手如何得到这些值啊?
解决方案 »
- [求助]如何在vb中用midi函数(api函数midiOutShortMsg或其他方法最好有实例)实现多种乐器同时演奏
- ====怎么获取WebBrowser打印预览窗口的句柄,我需要更改此预览窗口的大小====
- 请问如何使窗体的移动范围仅在屏幕内!
- 急啊,我想把我的本地拨通到异地的服务器上,然后下载或者下载数据到对方指它的目录?怎么做啊?
- 有几个问题,希望帮助,有分
- 分页显示
- 如何把SQL中的表导入到Excel中的问题!
- 求教:如何在Word中插入多个表格?
- 放分999,请999位网友进来签名,为我MM祝福,3天以后她就要参加研究生入学考试了,谢谢
- ShockwaveFlash1.SetVariable "commentMC.input_txt.text", "aaaaaa"
- 关于Access数据库用户登录的问题,请指教!
- 更新语句????急急急急,在线等待
我在VB+WIN2000里
shell("ipconfig/all",1)
它列出很多连接的属性,我就是想得到它们!
我只是打个比方,并不一定用这个DOS命令,只是想实现!
运行某个DOS命令后,能够得到它在DOS命令符下打这个命令的返回值!
我在DOS下打 cacls filename
可以看到某个文件或是文件夹,有那些用户有权限!
在VB里应该怎么做呢?
管道文件符 “>”
怎么做?
具体点好不好?
实现了马上结帖!
然后用程序读取test.txt,里面的内容就是你想要的。
shell("ipconfig/all>test.txt",1)
然后用程序读取test.txt,里面的内容就是你想要的。
在命令行是可以!
但在shell 里就生不出来了!
执行了shell 用搜索 可就是找不到test.txt
你还要帮帮我啊!
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End TypePrivate Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End TypePrivate Declare Function dcWaitForSingleObject Lib "kernel32" Alias "WaitForSingleObject" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As LongPrivate Declare Function dcCreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal _
lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As LongPrivate Declare Function dcCloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Long) As LongPrivate Declare Function dcGetExitCodeProcess Lib "kernel32" Alias "GetExitCodeProcess" (ByVal hProcess As Long, lpExitCode As Long) As Long
Public Declare Function dcTerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As LongPrivate Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Const WAIT_TIMEOUT As Long = &H102Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret As Long
Dim enAllFail As Long
On Error GoTo errExit
' Initialize the STARTUPINFO structure:
start.cb = Len(start)
' Start the shelled application:
ret = dcCreateProcess(0&, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
' Wait for the shelled application to finish:
ret = dcWaitForSingleObject(proc.hProcess, INFINITE)
If ret = WAIT_TIMEOUT Then
'After 15 min program may be hung?
Call dcTerminateProcess(proc.hProcess, enAllFail)
End If
Call dcGetExitCodeProcess(proc.hProcess, ret&)
Call dcCloseHandle(proc.hProcess)
ExecCmd = ret&
Exit Function
errExit:
'Error handler here
End Function
你试过没有?
我试了很次还是不行!
天啊救命啊!
比如:
我在建了个目录 d:\test
怎么知道有几个用户,或是一个用户对它有权限?
shell("command /c ipconfig/all>test.txt",1) 'win98
在分析test.txt