Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Can you show an example of the syntax I need to use? Commented Mar 18, 2014 at 21:29
  • Can you be more specific? Which part are you needing syntax for? You already seem to know how to use relative paths as demonstrated in your question. Commented Mar 18, 2014 at 21:52
  • Changing "C:\Documents\WindowsPowerShell\Scripts\test.ps1" to ".\test.ps1" and clicking the shortcut gives an error that it cannot recognize ".\test.ps1" as a cmdlet, executable, etc. Commented Mar 18, 2014 at 21:58
  • Here is another example C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -noexit -command "& Start-Process Powershell -verb RunAs .\test.ps1", this will cause an error when run from a shortcut that .\test.ps1 cannot be recognized. Commented Mar 18, 2014 at 22:08
  • How are you telling the script where to run from? Are you changing directories (cd) to it? Or are you specifying where to run from? If you don't specify the run-from location, it won't know you want it to run there. Commented Mar 18, 2014 at 22:17