我想用shell命令执行以下这句话:DTSRUN -N"新建包1" -F"D:\新建包1.dts",这句VB语句改则么写?

解决方案 »

  1.   

    建议你在MS-DOS模式下调试成功,然后用Shell直接加进去就行了,
    如你在Ms-dos窗口用“Start c:\1.txt”通过了,那么你用Shell的话就是
    Shell "start c:\1.txt"
      

  2.   

    另外。shelle命令默认是异步执行的,我怎么才能让不异步之行呢?
      

  3.   

    用API函数.参考下面的例子:
    Option Explicit' ShellWat sample
    ' Shows how to shell to another program, and wait until it finishes
    ' before continuing.Private Declare Function WaitForSingleObject Lib "kernel32" _
       (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As LongPrivate Declare Function CloseHandle Lib "kernel32" _
       (ByVal hObject As Long) As Long
       
    Private Declare Function OpenProcess Lib "kernel32" _
       (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
        ByVal dwProcessId As Long) As LongPrivate Const INFINITE = -1&
    Private Const SYNCHRONIZE = &H100000Private Sub Command1_Click()
        Dim iTask As Long, ret As Long, pHandle As Long
        iTask = Shell("notepad.exe", vbNormalFocus)
        pHandle = OpenProcess(SYNCHRONIZE, False, iTask)
        ret = WaitForSingleObject(pHandle, INFINITE)
        ret = CloseHandle(pHandle)
    End Sub