比如
用shell()调用了一个DOS命令!
在DOS界面上是有运行结果的!
请问各位高手如何得到这些值啊?

解决方案 »

  1.   

    我想你是不能得到这些具体的数据的因为它是DOS命令,除非它提供了外部接口.如果你只是想得到这个命令执行的结果内容不是具体的那么可以把DOS命令的结果先输出到文本文件中然后再读出这个文件...
      

  2.   

    就比如说!
    我在VB+WIN2000里
    shell("ipconfig/all",1)
    它列出很多连接的属性,我就是想得到它们!
    我只是打个比方,并不一定用这个DOS命令,只是想实现!
    运行某个DOS命令后,能够得到它在DOS命令符下打这个命令的返回值!
      

  3.   

    16位的解决方法好像有点难,你要是执行doa命令的话还是改用系统自带的函数吧
      

  4.   

    那就比如说:
    我在DOS下打 cacls filename
    可以看到某个文件或是文件夹,有那些用户有权限!
    在VB里应该怎么做呢?
      

  5.   

    不能用API吗?
    管道文件符  “>”
    怎么做?
    具体点好不好?
    实现了马上结帖!
      

  6.   

    shell("ipconfig/all>test.text",1)
    然后用程序读取test.txt,里面的内容就是你想要的。
      

  7.   

    唉,又打错字了,应该是:
    shell("ipconfig/all>test.txt",1)
    然后用程序读取test.txt,里面的内容就是你想要的。
      

  8.   

    兄弟不行啊!
    在命令行是可以!
    但在shell 里就生不出来了!
    执行了shell 用搜索 可就是找不到test.txt
    你还要帮帮我啊!
      

  9.   

    see thisOption ExplicitPrivate Type STARTUPINFO
      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
      

  10.   

    JennyVenus():
    你试过没有?
    我试了很次还是不行!
    天啊救命啊!
      

  11.   

    到www.21code.com下载一个"用VB制作DOS的控制台"的源代码吧
      

  12.   

    那请问各位高手,如何用VB语句得到一个本地文件的权限?
    比如:
    我在建了个目录 d:\test
    怎么知道有几个用户,或是一个用户对它有权限?
      

  13.   

    shell("cmd /c ipconfig/all>test.txt",1) 'win2000
    shell("command /c ipconfig/all>test.txt",1) 'win98
    在分析test.txt