PowerTip: Use PowerShell to Easily View Contents of VBScript


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

 

Comments (2)

  1. Walid Toumi says:

    hi,

    another variant:

    —————–8<————————————————–

    PS II> ls -LiteralPath $env:Path.Split(';') -filter *.vbs | gc | Out-Host -Paging

    —————–8<————————————————–

Skip to main content