{"id":8501,"date":"2012-08-02T11:59:00","date_gmt":"2012-08-02T11:59:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2012\/08\/02\/powertip-read-only-and-constant-variables\/"},"modified":"2012-08-02T11:59:00","modified_gmt":"2012-08-02T11:59:00","slug":"powertip-read-only-and-constant-variables","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-read-only-and-constant-variables\/","title":{"rendered":"PowerTip: Read Only and Constant Variables"},"content":{"rendered":"<p align=\"left\"><b>Summary<\/b>: Learn the difference between a read-only variable and a constant.<\/p>\n<p align=\"left\" style=\"padding-left: 30px\"><b>Question<\/b>: What is the difference between a read-only variable and a constant?<\/p>\n<p align=\"left\" style=\"padding-left: 30px\"><b>Answer<\/b>: A read-only variable is one with content that is&nbsp;<b>read-<\/b><strong>only<\/strong>. It can, however, be modified by using the S<b>et-Variable<\/b>&nbsp;cmdlet with the&nbsp;<b>&ndash;force<\/b>&nbsp;parameter. It can also be deleted by using R<b>emove-Variable &ndash;force<\/b>.&nbsp; A constant variable, however, cannot be deleted, nor can it be modified&#8211;even when using the force.<\/p>\n<p align=\"left\">\n<p align=\"left\">&nbsp;<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn the difference between a read-only variable and a constant. Question: What is the difference between a read-only variable and a constant? Answer: A read-only variable is one with content that is&nbsp;read-only. It can, however, be modified by using the Set-Variable&nbsp;cmdlet with the&nbsp;&ndash;force&nbsp;parameter. It can also be deleted by using Remove-Variable &ndash;force.&nbsp; A constant [&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":[356,3,45],"class_list":["post-8501","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-powertip","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Learn the difference between a read-only variable and a constant. Question: What is the difference between a read-only variable and a constant? Answer: A read-only variable is one with content that is&nbsp;read-only. It can, however, be modified by using the Set-Variable&nbsp;cmdlet with the&nbsp;&ndash;force&nbsp;parameter. It can also be deleted by using Remove-Variable &ndash;force.&nbsp; A constant [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/8501","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=8501"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/8501\/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=8501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=8501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=8501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}