November 27th, 2012

PowerTip: Use PowerShell to Easily View Contents of VBScript

Doctor Scripto
Scripter

Summary:  Learn how to use Windows PowerShell to view contents of a VBScript file.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily view the contents of a VBScript file, such as SLMGR.VBS? I do not know the path to the file.

Hey, Scripting Guy! Answer You do not need to know the path to the file. Use the Windows PowerShell Get-Command cmdlet to find the script (listed, incidentally, as an application) and pipe the results to Get-Content, as shown here.

Get-Command -Name slmgr.vbs | Get-Content | more

You can find the path to all of these types of VBScripts by using a wild card for the name, as shown here.

Get-Command -Name *.vbs -CommandType application | select path

 

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback