Trying to create a shortcut from network RRS feed

  • General discussion

  • From a powershell  command , I want to install a shortcut to the file on the network so the students can click the nctest.seb file to activate. Once the file activages, it will prompt the student for a yes or no question. However, the script is failing. I have the file saved on the server. What do I have configure incorrectly?

    # Create a Shortcut with Windows PowerShell
    $TargetFile = "$env:\\en8v\Data\Appdeploy\NCTest\NCTEST2020\NCTest.seb"
    $ShortcutFile = "$env:Public\Desktop\NCTESTSEB.lnk"
    $WScriptShell = New-Object -ComObject WScript.Shell
    $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
    $Shortcut.TargetPath = $TargetFile

    • Changed type Bill_Stewart Tuesday, April 14, 2020 5:23 PM
    • Moved by Bill_Stewart Tuesday, April 14, 2020 5:23 PM Abandoned
    Thursday, December 12, 2019 1:50 PM

All replies

  • Your target file and shortcut file strings seem wrong.

    That would only work if you have environment variables with those names (that's what the "env:" prefix refers to).

    -- Bill Stewart [Bill_Stewart]

    Thursday, December 12, 2019 2:52 PM
  • Thanks for replying,

    Could you give me an example? 

    Tuesday, December 17, 2019 2:10 PM