Global Variable in Command Prompt

batch-file, command, dos

Solution

By setting a system environment variable permanently. See here.

Applies To: Windows Server 2008, Windows Vista

For Windows XP download and install Windows XP Service Pack 2 Support Tools

Problem

How do I declare a global variable in a batch script? Example: Test1.bat: ``` set testvar=C:\Windows echo %testvar% ``` Now I should be able to use this testvar in other batch script (test2.bat) Test2.bat: ``` echo %testvar% ``` Thanks and Regards!

Original source

Related problems