none
Powershell - Getting Target Path of Shortcut w/ Target having Spaces RRS feed

  • Question

  • Hi Guys,

        I'm trying to get the target path of a few thousand shortcuts.  I'm using the Get-ChildItem and looking at targetpath but its not showing the full target path on some of the shortcuts. For example, If I have a shortcut:

    Shortcut#1:  "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe \\server77\directory$\powershellcodescript.ps1"

    it will only return: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"

    and omits the "\\server77\directory$\powershellcodescript.ps1" part that is being passed to powershell.exe

    Does anyone have any ideas or has anyone ran into this before?  I tried looking at other properties of Get-ChildItem and not making any progress.  It seems to not read the full shortcut.  Any help/guidance would be greatly appreciated.

    -Bill

    Wednesday, January 13, 2016 1:32 PM

Answers

  • A shortcut is a program and a target file.  You cannot specify both together.

    Get-ChildItem does not show shortcuts. It shows files and folders.


    \_(ツ)_/

    • Marked as answer by Bill Quandries Wednesday, January 13, 2016 1:58 PM
    Wednesday, January 13, 2016 1:44 PM

All replies