{"id":3847,"date":"2016-01-26T10:00:26","date_gmt":"2016-01-26T09:00:26","guid":{"rendered":"http:\/\/www.samlogic.net\/blog\/?p=3847"},"modified":"2019-07-07T18:27:10","modified_gmt":"2019-07-07T18:27:10","slug":"with-the-setenv-command-you-can-set-environment-variables-from-visual-installer","status":"publish","type":"post","link":"https:\/\/www.samlogic.net\/blog\/2016\/01\/with-the-setenv-command-you-can-set-environment-variables-from-visual-installer\/","title":{"rendered":"With the SETENV command you can set environment variables from Visual Installer"},"content":{"rendered":"<p>In this <a href=\"https:\/\/www.samlogic.net\/blog\/2015\/11\/using-environment-variables-in-visual-installer\/\">blog post<\/a> we explained how to use Windows&#8217; environment variables in <a href=\"https:\/\/www.samlogic.net\/visual-installer\/visual-installer.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Visual Installer<\/a>; for example as a part of a file path. You can also create or change values for environment variables in the system during an installation by using a script command in Visual Installer&#8217;s <a href=\"https:\/\/www.samlogic.net\/visual-installer\/tips\/tips-pages\/visual-installer-scripting-language\/visual-installer-scripting-language.htm\" target=\"_blank\" rel=\"noopener noreferrer\">scripting language<\/a>. The name of the command is <strong>SETENV<\/strong> and you can use this command to set an environment variable to a specific value. If the environment variable does not exists, it will be created. If it already exists, its value will be updated.<\/p>\n<p><strong>Examples of usage<\/strong><br \/>\nThe example below shows how to use the <strong>SETENV<\/strong> command to set an environment variable with the variable name <strong>MyVariable<\/strong> to the value <strong>MyValue<\/strong>:<\/p>\n<p><span style=\"color: #008000;\">\/\/ Example 1: Set MyVariable = MyValue<\/span><br \/>\n<strong><span style=\"color: #000080;\">SETENV<\/span> MyVariable, MyValue<\/strong><\/p>\n<p>You can also use Visual Installer&#8217;s variables (for example <strong>%DESTDIR<\/strong>) when you set values. The example below shows how to set an environment variable with the variable name <strong>MyAppsFolder<\/strong> to the path <strong>%DESTDIR\\MyApps<\/strong>:<\/p>\n<p><span style=\"color: #008000;\">\/\/ Example 2: Set MyAppsFolder = %DESTDIR\\MyApps<\/span><br \/>\n<strong><span style=\"color: #000080;\">SETENV<\/span> MyAppsFolder, <span style=\"color: #800000;\">%DESTDIR<\/span>\\MyApps<\/strong><\/p>\n<p>The picture below shows same examples in Visual Installer&#8217;s scripting editor:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.samlogic.net\/blog\/images\/product-visual-installer\/visual-installer-script-setenv.png\" alt=\"\" border=\"0\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog post we explained how to use Windows&#8217; environment variables in Visual Installer; for example as a part of a file path. You can also create or change values for environment variables in the system during an installation by using a script command in Visual Installer&#8217;s scripting language. The name of the command &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.samlogic.net\/blog\/2016\/01\/with-the-setenv-command-you-can-set-environment-variables-from-visual-installer\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;With the SETENV command you can set environment variables from Visual Installer&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10,15],"tags":[],"_links":{"self":[{"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/posts\/3847"}],"collection":[{"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/comments?post=3847"}],"version-history":[{"count":1,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/posts\/3847\/revisions"}],"predecessor-version":[{"id":6058,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/posts\/3847\/revisions\/6058"}],"wp:attachment":[{"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/media?parent=3847"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/categories?post=3847"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/tags?post=3847"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}