{"id":6511,"date":"2015-04-22T00:01:00","date_gmt":"2015-04-22T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/04\/22\/using-named-location-stacks-in-powershell\/"},"modified":"2019-02-18T10:29:48","modified_gmt":"2019-02-18T17:29:48","slug":"using-named-location-stacks-in-powershell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/using-named-location-stacks-in-powershell\/","title":{"rendered":"Using Named Location Stacks in PowerShell"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Microsoft Scripting Guy, Ed Wilson, talks about using named location stacks in Windows PowerShell.<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>&nbsp;Hey, Scripting Guy! If I need to move around in two types of locations, how would I do it? Suppose I need to look in various places in my profile, and then I need to do some work in data locations elsewhere on my hard drive. How would I be able to keep track of the different locations?<\/p>\n<p>&mdash;AK<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>&nbsp;Hello AK,<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. Today is the last day of the Windows PowerShell Summit in Charlotte. In fact, tonight the Charlotte Windows PowerShell User Group is having a special meeting to celebrate. We have invited Lee Holmes and Paul Higinbotham from the Windows PowerShell team to talk about their favorite Windows PowerShell tips and tricks. This will be a highly interactive session, and there are only a few seats left for this free event. To register for this unique opportunity, go to <a href=\"http:\/\/www.meetup.com\/Charlotte-PowerShell-Users-Group\/events\/221424922\/\" target=\"_blank\">Everyday PowerShell &ndash; My Favorite PowerShell Hacks with Lee Holmes<\/a>.<\/p>\n<p>One of the things that makes navigating around in the Windows PowerShell console or prompt a bit annoying is typing the long path names. Of course, Tab expansion helps this task, but it only expands subdirectory by subdirectory, and therefore, for deeply nested folders, there is still a lot of stopping and starting.<\/p>\n<p>Of course, using a mouse in File Explorer is not necessarily any faster. In fact, it usually is not due to the amount of time that it takes for thousands of files to scroll into the pane each time one clicks a new subfolder. With the <b>Back<\/b> button in File Explorer, this task became a bit easier. So, where is the <b>Back<\/b> button in the Windows PowerShell console? Well, this is where location stacks can come into play.<\/p>\n<p style=\"margin-left:30px\"><b>Note&nbsp;<\/b> This post continues yesterday&#039;s Hey, Scripting Guy! Blog post, <a href=\"https:\/\/devblogs.microsoft.com\/scripting\/location-location-location-in-powershell\/\" target=\"_blank\">Location, Location, Location in PowerShell<\/a>. If you have not read that one yet, you should before you continue reading today&rsquo;s post.<\/p>\n<p>If I am working in multiple locations, and I can logically group them, then I like to create named locations. This is easily done by supplying a name for the stack when I call the <b>Push-Location<\/b> (<b>PushD<\/b> is the alias) cmdlet. If the stack name does not exist, it is created. If the stack name does exist, the new location is added to that particular named stack.<\/p>\n<p>In the following example, I am working with a bunch of folders that are all named <b>FSO<\/b> in some fashion. So I create a new stack named <b>FSO<\/b>, and add the locations to that stack.<\/p>\n<p>When you use <b>Push-Location<\/b>, the location being navigated to is added to the location stack, then the current location changes to the path specified. In the following examples, I begin at drive C, and navigate to the C:\\fso folder. My current location changes to C:\\fso and the path is stored in a location stack named <b>FSO<\/b>. I then change my current location to C:\\fso1, and once again, add the path to the location stack named <b>FSO<\/b>. I again change my location to C:\\fso2, and I also add that location to the stack. Here are the commands and the associated output:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; pushd -StackName fso -Path C:\\fso<\/p>\n<p style=\"margin-left:30px\">PS C:\\fso&gt; pushd -StackName fso -Path C:\\fso1<\/p>\n<p style=\"margin-left:30px\">PS C:\\fso1&gt; pushd -StackName fso -Path C:\\fso2<\/p>\n<p style=\"margin-left:30px\">PS C:\\fso2&gt;&nbsp;<\/p>\n<p>Because I have not used <b>Pop-Location<\/b> (<b>PopD<\/b> is the alias), all three locations are stored on the <b>FSO<\/b> stack. Now I want to navigate to a few locations in my profile. I also want to store those locations, but I want them to be accessible via a different name. So I create a new location stack named <b>Ed<\/b>. Once again, I navigate to the different locations by using <b>PushD<\/b>. Here are the commands and the output:<\/p>\n<p style=\"margin-left:30px\">PS C:\\fso2&gt; pushd -StackName ed -Path C:\\Users\\ed\\Documents<\/p>\n<p style=\"margin-left:30px\">PS C:\\Users\\ed\\Documents&gt; pushd -StackName ed -Path C:\\Users\\ed\\Downloads<\/p>\n<p style=\"margin-left:30px\">PS C:\\Users\\ed\\Downloads&gt; pushd -StackName ed -Path C:\\Users\\ed\\Pictures<\/p>\n<p style=\"margin-left:30px\">PS C:\\Users\\ed\\Pictures&gt;<\/p>\n<p>I have added six locations to two differently named stacks. If I use <b>Get-Location &ndash;Stack<\/b>, but I do not specify any names, I will retrieve the default location stack. This command is shown here:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; Get-Location -Stack<\/p>\n<p>Because all six of my locations are on named stacks, nothing returns from the command. I then use the Up arrow, and try to look at the <b>FSO<\/b> stack. The command generates an error message. This command and its output are shown here:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-4-22-15-01.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-4-22-15-01.png\" alt=\"Image of error message\" title=\"Image of error message\" \/><\/a><\/p>\n<p>The reason the error occurs is that the <b>&ndash;Stack<\/b> parameter is used for the default stack only. I cannot specify a name here. Instead, I need to use the <b>&ndash;StackName<\/b> parameter. When I do this, I can retrieve the locations as shown here:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; Get-Location -StackName fso<\/p>\n<p style=\"margin-left:30px\">Path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">C:\\&nbsp;&nbsp;&nbsp;<\/p>\n<p>As shown here, I can also retrieve locations from the <b>Ed<\/b> stack:<\/p>\n<p style=\"margin-left:30px\">PS C:\\fso2&gt; Get-Location -StackName ed<\/p>\n<p style=\"margin-left:30px\">Path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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sp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">C:\\fso2&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p>When it comes time to revisit the locations, I use <b>Set-Location<\/b> to change my default location stack name. Then I can use <b>PopD<\/b> to move through the directories. This command is shown here:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; Set-Location -StackName fso<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; popd<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; Get-Location -Stack<\/p>\n<p style=\"margin-left:30px\">Path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">C:\\ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; popd<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; popd<\/p>\n<p style=\"margin-left:30px\">PS C:\\fso1&gt; popd<\/p>\n<p style=\"margin-left:30px\">PS C:\\fso&gt; popd<span style=\"font-size:12px\">&nbsp;<\/span><\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt;&nbsp;<\/p>\n<p>When I reach the end of the stack, I change to my new stack by again calling the <b>Set-Location<\/b> cmdlet and then walking through those locations by using <b>Pop-Location <\/b>(<b>PopD<\/b>):<\/p>\n<p style=\"margin-left:30px\">PS C:\\Users\\ed\\Downloads&gt; Set-Location -StackName ed<\/p>\n<p style=\"margin-left:30px\">PS C:\\Users\\ed\\Downloads&gt; Get-Location -Stack<\/p>\n<p style=\"margin-left:30px\">Path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">C:\\fso2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\"><span style=\"font-size:12px\">PS C:\\Users\\ed\\Downloads&gt; popd<\/span><\/p>\n<p>AK, that is all there is to using named locations in Windows PowerShell. Provider Week will continue tomorrow when I will talk about more cool stuff.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b><span style=\"font-size:12px\">&nbsp;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, talks about using named location stacks in Windows PowerShell. &nbsp;Hey, Scripting Guy! If I need to move around in two types of locations, how would I do it? Suppose I need to look in various places in my profile, and then I need to do some work in data [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[51,3,4,45],"class_list":["post-6511","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-getting-started","tag-scripting-guy","tag-scripting-techniques","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, talks about using named location stacks in Windows PowerShell. &nbsp;Hey, Scripting Guy! If I need to move around in two types of locations, how would I do it? Suppose I need to look in various places in my profile, and then I need to do some work in data [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/6511","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\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=6511"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/6511\/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=6511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=6511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=6511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}