{"id":755,"date":"2018-11-13T08:16:49","date_gmt":"2018-11-13T16:16:49","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/koryt\/?p=755"},"modified":"2019-10-09T15:49:57","modified_gmt":"2019-10-09T23:49:57","slug":"powershell-powertip-customizing-your-prompt","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powershell-powertip-customizing-your-prompt\/","title":{"rendered":"PowerShell PowerTip: Customizing your prompt"},"content":{"rendered":"<div>\n<div class=\"_1FlPSu-rTEVeiEA_uwwhyK _2_Fga_W1WnFlfCD2ZmXK2a\">\n<div class=\"_3Z5n8Twgu0Hm8h3pSAqCVR allowTextSelection\">\n<div class=\"_3GW6Km8J_QqAnFBRTZ217Q\">\n<div>I&#8217;ve been taking a break from the blog for a while due to some personal reasons, but I had a few people ask me about my PowerShell prompt recently.<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div><img decoding=\"async\" class=\"alignnone size-full wp-image-86516\" src=\"http:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2018\/11\/profile-1024x444.png\" alt=\"\" width=\"1024\" height=\"444\" srcset=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2018\/11\/profile-1024x444.png 1024w, https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2018\/11\/profile-1024x444-300x130.png 300w, https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2018\/11\/profile-1024x444-768x333.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/div>\n<div><\/div>\n<div>\n<div class=\"_1FlPSu-rTEVeiEA_uwwhyK _2_Fga_W1WnFlfCD2ZmXK2a\">\n<div class=\"_3Z5n8Twgu0Hm8h3pSAqCVR allowTextSelection\">\n<div><\/div>\n<div>I like extra horizontal space, so I removed the path from the prompt and put it in the window title bar. I also just display the current time in the prompt itself.<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<div>You can customize your prompt by using your profile and overriding the &#8220;Prompt&#8221; function.<\/div>\n<div>\n<div class=\"_1FlPSu-rTEVeiEA_uwwhyK _2_Fga_W1WnFlfCD2ZmXK2a\">\n<div class=\"_3Z5n8Twgu0Hm8h3pSAqCVR allowTextSelection\">\n<div class=\"_3GW6Km8J_QqAnFBRTZ217Q\">\n<div><\/div>\n<div class=\"SgNILnwCOx4T-ksOxutRn\">A coworker\u00a0of mine, Tony Radkiewicz, used a similar prompt and I really liked it so I&#8217;ve been using it since.<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div class=\"_1WprirXmwrr1tPFDyFcLIW _3T_0izEBoQ4deL5A42nKOm allowTextSelection\">\n<div class=\"rps_6bd6\">\n<div lang=\"EN-US\">\n<pre>function prompt \r\n{\r\n$Time = (Get-Date).ToString(\"hh:mm\") \r\n$host.ui.rawui.WindowTitle = (Get-Location)\r\n\"$Time&gt; \"\r\n}<\/pre>\n<div class=\"x_WordSection1\">That&#8217;s all for now, I&#8217;ll try to get some more tips out as I have time!<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been taking a break from the blog for a while due to some personal reasons, but I had a few people ask me about my PowerShell prompt recently. I like extra horizontal space, so I removed the path from the prompt and put it in the window title bar. I also just display the [&hellip;]<\/p>\n","protected":false},"author":7300,"featured_media":87096,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1738],"tags":[2221,2125,377,356],"class_list":["post-755","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-kory-thacher","tag-koryt","tag-powershell","tag-powertip"],"acf":[],"blog_post_summary":"<p>I&#8217;ve been taking a break from the blog for a while due to some personal reasons, but I had a few people ask me about my PowerShell prompt recently. I like extra horizontal space, so I removed the path from the prompt and put it in the window title bar. I also just display the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/7300"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=755"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/755\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}