Forum Discussion
Keith732
Mar 08, 2019Copper Contributor
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.