{"id":1801,"date":"2011-11-17T10:11:36","date_gmt":"2011-11-17T15:11:36","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1801"},"modified":"2011-11-17T10:11:36","modified_gmt":"2011-11-17T15:11:36","slug":"finding-files-in-the-path-a-pipeline-perk","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/","title":{"rendered":"Finding Files in the Path &#8211; A Pipeline Perk"},"content":{"rendered":"<p>I've been chipping in on a forum post about finding if a given file exists in any folder within the system environmental %PATH% variable using Windows PowerShell. There are several ways you might approach this. But the best way in my opinion is to leverage the PowerShell pipeline. Perhaps you don't really need the solution but I think it is a valuable learning opportunity.<!--more--><\/p>\n<p>First off, you can access Windows environmental variables with the Environment PSProvider. All environmental variables can be in the ENV: psdrive.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS S:\\> dir env:<br \/>\n[\/cc]<\/p>\n<p>The easy way to reference a specific variable is like this:<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS S:\\> $env:PSModulePath<br \/>\nC:\\Users\\Jeff\\Documents\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\;C:\\Program Files\\Intel Corporation\\PowerShell\\Modules<br \/>\n[\/cc]<\/p>\n<p>So to get the %PATH% variable we would use $env:Path. Because the path is stored as a semi-colon delimted entries we can split it.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS S:\\> $env:path.split(\";\")<br \/>\n%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\<br \/>\nC:\\Program Files\\Common Files\\Microsoft Shared\\Microsoft Online Services<br \/>\nC:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Microsoft Online Services<br \/>\nC:\\Program Files (x86)\\VMware\\VMware vSphere CLI\\Perl\\site\\bin<br \/>\nC:\\Program Files (x86)\\VMware\\VMware vSphere CLI\\Perl\\bin<br \/>\nC:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common<br \/>\nC:\\Windows\\system32<br \/>\nC:\\Windows<br \/>\nC:\\Windows\\System32\\Wbem<br \/>\nC:\\Windows\\System32\\WindowsPowerShell\\v1.0\\<br \/>\nc:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\<br \/>\nc:\\Program Files\\Microsoft SQL Server\\100\\Tools\\Binn\\<br \/>\nc:\\Program Files\\Microsoft SQL Server\\100\\DTS\\Binn\\<br \/>\nc:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\VSShell\\Common7\\IDE\\<br \/>\nc:\\Program Files (x86)\\Microsoft SQL Server\\100\\DTS\\Binn\\<br \/>\nC:\\Windows\\System32\\Windows System Resource Manager\\bin<br \/>\nC:\\Program Files\\Windows Imaging\\<br \/>\nC:\\Windows\\System32\\Windows System Resource Manager\\bin<br \/>\n[\/cc]<\/p>\n<p>Each path is written to the pipeline. Because the goal is to filter paths that only contain the file, we can take advantage of Where-Object.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS S:\\> $env:path.split(\";\") | Where {test-path -path \"$_\\notepad.exe\"}<br \/>\nC:\\Windows\\system32<br \/>\nC:\\Windows<br \/>\n[\/cc]<\/p>\n<p>The $_ is the current object in the pipeline, or each path element that comes from splitting the path. If Test-Path is True, then the path element is passed to the end of the pipeline. An alternative might be to pipe to Join-Path which uses the piped in value for its -Path parameter.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS S:\\> $env:path.split(\";\") | Join-path -child \"notepad.exe\" | Where {test-path $_}<br \/>\nC:\\Windows\\system32\\notepad.exe<br \/>\nC:\\Windows\\notepad.exe<br \/>\n[\/cc]<\/p>\n<p>If we wanted to get the file details we can take this a step further and pipe to Get-Item. Again, the value will be used for the -Path parameter.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS S:\\> $env:path.split(\";\") | Join-path -child \"notepad.exe\" | Where {test-path $_} | get-item<\/p>\n<p>    Directory: C:\\Windows\\system32<\/p>\n<p>Mode                LastWriteTime     Length Name<br \/>\n----                -------------     ------ ----<br \/>\n-a---         7\/13\/2009   9:39 PM     193536 notepad.exe<\/p>\n<p>    Directory: C:\\Windows<\/p>\n<p>Mode                LastWriteTime     Length Name<br \/>\n----                -------------     ------ ----<br \/>\n-a---         7\/13\/2009   9:39 PM     193536 notepad.exe<br \/>\n[\/cc]<\/p>\n<p>For this particular exercise there is one limitation: any path element that uses a environmental variable like %Windir%, won't work. I'll work on that separately. The main takeaway is to look at cmdlet parameters and see where you can leverage the pipeline. Let PowerShell do the work for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been chipping in on a forum post about finding if a given file exists in any folder within the system environmental %PATH% variable using Windows PowerShell. There are several ways you might approach this. But the best way in my opinion is to leverage the PowerShell pipeline. Perhaps you don&#8217;t really need the solution&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[8],"tags":[309,251,98,534,128],"class_list":["post-1801","post","type-post","status-publish","format-standard","hentry","category-scripting","tag-filtering","tag-join-path","tag-pipeline","tag-powershell","tag-test-path"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Finding Files in the Path - A Pipeline Perk &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Finding Files in the Path - A Pipeline Perk &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I&#039;ve been chipping in on a forum post about finding if a given file exists in any folder within the system environmental %PATH% variable using Windows PowerShell. There are several ways you might approach this. But the best way in my opinion is to leverage the PowerShell pipeline. Perhaps you don&#039;t really need the solution...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-17T15:11:36+00:00\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1801\\\/finding-files-in-the-path-a-pipeline-perk\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1801\\\/finding-files-in-the-path-a-pipeline-perk\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Finding Files in the Path &#8211; A Pipeline Perk\",\"datePublished\":\"2011-11-17T15:11:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1801\\\/finding-files-in-the-path-a-pipeline-perk\\\/\"},\"wordCount\":558,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"keywords\":[\"filtering\",\"Join-Path\",\"Pipeline\",\"PowerShell\",\"Test-Path\"],\"articleSection\":[\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1801\\\/finding-files-in-the-path-a-pipeline-perk\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1801\\\/finding-files-in-the-path-a-pipeline-perk\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1801\\\/finding-files-in-the-path-a-pipeline-perk\\\/\",\"name\":\"Finding Files in the Path - A Pipeline Perk &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2011-11-17T15:11:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1801\\\/finding-files-in-the-path-a-pipeline-perk\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1801\\\/finding-files-in-the-path-a-pipeline-perk\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1801\\\/finding-files-in-the-path-a-pipeline-perk\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Scripting\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/scripting\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Finding Files in the Path &#8211; A Pipeline Perk\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Finding Files in the Path - A Pipeline Perk &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/","og_locale":"en_US","og_type":"article","og_title":"Finding Files in the Path - A Pipeline Perk &#8226; The Lonely Administrator","og_description":"I've been chipping in on a forum post about finding if a given file exists in any folder within the system environmental %PATH% variable using Windows PowerShell. There are several ways you might approach this. But the best way in my opinion is to leverage the PowerShell pipeline. Perhaps you don't really need the solution...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-11-17T15:11:36+00:00","author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Finding Files in the Path &#8211; A Pipeline Perk","datePublished":"2011-11-17T15:11:36+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/"},"wordCount":558,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"keywords":["filtering","Join-Path","Pipeline","PowerShell","Test-Path"],"articleSection":["Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/","name":"Finding Files in the Path - A Pipeline Perk &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"datePublished":"2011-11-17T15:11:36+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1801\/finding-files-in-the-path-a-pipeline-perk\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Scripting","item":"https:\/\/jdhitsolutions.com\/blog\/category\/scripting\/"},{"@type":"ListItem","position":2,"name":"Finding Files in the Path &#8211; A Pipeline Perk"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":2425,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2425\/friday-fun-expand-environmental-variables-in-powershell-strings\/","url_meta":{"origin":1801,"position":0},"title":"Friday Fun: Expand Environmental Variables in PowerShell Strings","author":"Jeffery Hicks","date":"June 29, 2012","format":false,"excerpt":"This week I was working on a project that involved using the %PATH% environmental variable. The challenge was that I have some entries that look like this: %SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\. When I try to use that path in PowerShell, it complains because it doesn't expand %SystemRoot%. What I needed was a way\u2026","rel":"","context":"In &quot;CommandLine&quot;","block_context":{"text":"CommandLine","link":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/06\/powershellvariable-300x71.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":817,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/817\/module-mania\/","url_meta":{"origin":1801,"position":1},"title":"Module Mania","author":"Jeffery Hicks","date":"August 12, 2010","format":false,"excerpt":"More and more, you're seeing members of the Windows PowerShell community package their contributions into modules, myself included. Although you'll probably still see a lot of individual functions because it is often easier to demonstrate or educate. I received a comment on my Weather module that I thought merited a\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/get-command-module-300x224.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1653,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1653\/the-powershell-day-care-building-scriptblocks\/","url_meta":{"origin":1801,"position":2},"title":"The PowerShell Day Care: Building ScriptBlocks","author":"Jeffery Hicks","date":"September 22, 2011","format":false,"excerpt":"Good morning kids and welcome to the PowerShell Day Care center. We offer a creative and nurturing environment for PowerShell professionals of all ages. Later there might even be juice and cookies. But first let's get out our blocks, our scriptblocks, and start building. I've written a number of posts\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1173,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/","url_meta":{"origin":1801,"position":3},"title":"Get My Variables","author":"Jeffery Hicks","date":"March 2, 2011","format":false,"excerpt":"As you might imagine I write a lot of PowerShell scripts and examples. Often my PowerShell Window is open for days at a time. One challenge I have always has is trying to remember what variables I have defined. If I knew the name I'd simply use Get-Variable. What I\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1143,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1143\/set-file-encoding\/","url_meta":{"origin":1801,"position":4},"title":"Set File Encoding","author":"Jeffery Hicks","date":"February 15, 2011","format":false,"excerpt":"For most people, when you create a script in PowerShell you generally don't worry too much about how it is encoded. Most everything you encounter in PowerShell uses Unicode files. But when sharing files sometimes this causes problems. For example, when I post a script for download here, I need\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1136,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1136\/friday-fun-snappy-shortcuts\/","url_meta":{"origin":1801,"position":5},"title":"Friday Fun &#8211; Snappy Shortcuts","author":"Jeffery Hicks","date":"February 11, 2011","format":false,"excerpt":"In one of my recent Prof. PowerShell columns, I wrote about using the Wscript.Shell VBScript object in PowerShell to retrieve special folder paths. Another handy trick is the ability to create shortcut links to either file or web resources. Let me show you how to accomplish this in PowerShell and\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/create-shortcuts-300x185.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1801","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=1801"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1801\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1801"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1801"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1801"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}