Browse For A VBS Script And Send The Results To Notepad

 

In my previous post entitled Browse For A VBS Script And Send The Results To The Command Prompt Window below I wrote a VBS script that would allow you to browse for a VBS script and then execute the script and send the results to the command prompt window.

 

Here is a script that allows you to browse for a VBS script and when executed the results will be sent to notepad using the same process as the command prompt script version.

 

VBS Script:

 

Set objDialog = CreateObject("UserAccounts.CommonDialog")

objDialog.Filter = "VBS Scripts|*.Vbs"

objDialog.InitialDir = "C:\"

intResult = objDialog.ShowOpen

 

Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists("ResultsSet.Txt") Then

objFSO.DeleteFile "ResultsSet.Txt"

End If

 

Set objShell = CreateObject("WScript.Shell")

Set objOutput = objFSO.CreateTextFile("ResultsSet.Txt")

objOutput.Close

 

strCmdLine1 = strCmdLine & "Cmd /C Cscript //NoLogo "  & Chr(34) & objDialog.FileName & Chr(34)

objShell.Run strCmdLine1 & " >> ResultsSet.Txt",, True

objShell.Run "Notepad.Exe ResultsSet.Txt"

 

Set objOutput = Nothing

 

Browse For A Vbs Script And Send The Results To The Command Prompt Window

http://myitforum.com/cs2/blogs/dhite/archive/2007/06/10/browse-for-a-vbs-script-and-send-the-results-to-the-command-prompt-window.aspx

 

Published Sunday, August 26, 2007 12:00 PM by dhite
Filed under:

Comments

# Browse For A VBS Script And Send The Results To A Word Document

In my previous post entitled Browse For A VBS Script And Send The Results To The Command Prompt Window

Sunday, February 03, 2008 9:25 AM by Don Hite