Forum Discussion

Keith732's avatar
Keith732
Copper Contributor
Mar 08, 2019

Running Powershell script as a shortcut

Hello all, 

 

I am attempting to have a powershell script run as a shortcut to output some simple information to a text file. 

I have created this one line script named ipscript.ps1

get-netipaddress -addressfamily IPv4 | format-table > $($env:userprofile + '\Desktop\info.txt')

 

Then I created a shortcut and modified the target in the shortcut. 

as such

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\Software\ipscript.ps1"

 

After double clicking the shortcut nothing happens and no file is output. If I run the one line script by itself in powershell the file is created. 

 

Can anyone point me in the right direction? I thank you in advance. 

 

2 Replies

  • Darrick's avatar
    Darrick
    Brass Contributor

    I created and ran the shortcut successfully.

    The info.txt output file is located in: %userprofile%\desktop

     

    Review your entries for typos.

  • Keith732's avatar
    Keith732
    Copper Contributor

    Does anyone have any basic ways of allowing an non-admin to run a powershell script and have it out put a file?

Resources