PowerTip: Use PowerShell to Easily View Contents of VBScript

PowerTip: Use PowerShell to Easily View Contents of VBScript

  • Comments 2
  • Likes

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

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • wonderful powertip!

  • hi,

    another variant:

    -----------------8<--------------------------------------------------

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

    -----------------8<--------------------------------------------------