{"id":3481,"date":"2015-02-10T18:39:48","date_gmt":"2015-02-11T00:39:48","guid":{"rendered":"http:\/\/bililite.com\/blog\/?p=3481"},"modified":"2015-02-10T18:39:48","modified_gmt":"2015-02-11T00:39:48","slug":"creating-a-powershell-shortcut","status":"publish","type":"post","link":"https:\/\/bililite.com\/blog\/2015\/02\/10\/creating-a-powershell-shortcut\/","title":{"rendered":"Creating a PowerShell shortcut"},"content":{"rendered":"<p>I'm sure there must be an easier way to run a program from PowerShell, but I haven't found anything simpler than<\/p>\n<pre><code>& \"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\"<\/code><\/pre>\n<p>with the ampersand and the full path. I could add <code>\"C:\\Program Files (x86)\\Notepad++\"<\/code> to <code>$env:PATH<\/code>, but I'd still have to type <code>notepad++.exe <em>file<\/em><\/code>. I wanted some way to make a shortcut to a program name without having to create a new file, either a .LNK or .BAT file.<\/p>\n<p>Turns out you can do this with <a href=\"http:\/\/www.powershellpro.com\/powershell-tutorial-introduction\/powershell-functions-filters\/\">PowerShell functions<\/a>: <\/p>\n<pre><code>function npp { & \"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\" $args }<\/code><\/pre>\n<p>lets me run Notepad++ from PowerShell without nearly so much typing. Stuck that in my Profile.ps1 and now I'm happy.<br \/>\nHope this turns out to be useful to someone.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I'm sure there must be an easier way to run a program from PowerShell, but I haven't found anything simpler than &#038; \"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\" with the ampersand and the full path. I could add \"C:\\Program Files (x86)\\Notepad++\" to $env:PATH, but I'd still have to type notepad++.exe file. I wanted some way to make a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/3481"}],"collection":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/comments?post=3481"}],"version-history":[{"count":2,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/3481\/revisions"}],"predecessor-version":[{"id":3483,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/3481\/revisions\/3483"}],"wp:attachment":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/media?parent=3481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/categories?post=3481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/tags?post=3481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}