以下代码用来查找文件(word)在硬盘中(Path)的完整路径返回给b,虽然代码能够获得想要的结果,但是每次运行都有CMD的黑窗口一闪而过,想请教大师如何隐藏或最小化CMD运行窗口,请求大神指点一二,万分感谢。。
Sub 获取文件路径()
Dim older$, b, word$, Path$
Dim wsc As Object
Path = "D:\"
word = "001.jpg"
Set wsc = CreateObject("wscript.shell")
older = "cmd /c Dir " & Path & word & " /a /b /s"
b = wsc.exec(older).stdout.readall
Debug.Print b
End Sub