|
本帖最后由 slore 于 2018-4-21 11:55 编辑
'---------------------------------------------------
Set objShell = CreateObject("WSCript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
pathx = objFSO.GetFile(WScript.scriptFullName).ParentFolder.Path
Sub RunHide()
Dim self, args, i
self = """" & WScript.scriptFullName & """"
args = " "
For i = 1 To objArgs.Count
args = args & """" & objArgs(i) & """ "
Next
If args = " " Then args = " -dummy"
objShell.Run "cscript.exe " & self & args, 0, False
WSCript.Quit(0)
End Sub
If objArgs.Count = 0 Then
RunHide
ElseIf objArgs(0) = "-hide" Then
RunHide
End If
Set cmd = objShell.exec("cmd.exe")
cmd.stdin.WriteLine "dir c:\ /b /s /a-d > " & Chr(34) & pathx & Chr(34) & "\c.txt"
cmd.stdin.WriteLine "dir c:\*.dll /b /s /a-d > " & Chr(34) & pathx & Chr(34) & "\dll.txt"
cmd.stdin.WriteLine "exit"
Do Until cmd.Status = 1
WScript.sleep 100
Loop
MsgBox "脚本运行完毕"
用第一个参数区分,不需要临时文件。 |
|