Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global Variable in Command Prompt [duplicate]

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!

like image 317
user2150777 Avatar asked Oct 21 '22 15:10

user2150777


1 Answers

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

like image 113
Jacob Seleznev Avatar answered Oct 27 '22 10:10

Jacob Seleznev