首页 /编程语言和算法/VB6/VBA/ASP
 VBA代码 sheel 执行命令行 等待并读取结果 CMD
2025年3月18日 15:18
Function ShellAndWait(cmd As String) As String
    'sheel 执行命令行 等待并读取结果
    Dim oShell As Object, oExec As Object
    Set oShell = CreateObject("WScript.Shell")
    Set oExec = oShell.exec(cmd)
    ShellAndWait = oExec.StdOut.ReadAll
    Set oShell = Nothing
    Set oExec = Nothing
End Function


 
全部回复(0)
首页 | 电脑版 |