Jump to content

environment variables capitalization


Recommended Posts


Nope, caps wont make any difrence. You could even use caps in the VARIABLE= and no caps in the %variable% of a CMD file and all will be OK

In paths to places on your HDD "%ProgramFiles%", "%PROGRAMFILES%" and "%programfiles%" are all the same (just a matter of taste)

Edited by ricktendo64
Link to comment
Share on other sites

For the purpose of identification of variables in cmd scripts, using all caps helps you to know that you are using a valid variable within your script. A small script is easy to manage but as they get bigger, then stricter control of variables is needed to save mistakes. It also helps with in programming editors that can invoke an autocomplete box with a selection of items and so if you choose an item with all caps then you know that it is a variable.

@echo off

set VARIABLE=string

echo Contents of the variable is %VARIABLE%

pause

As shown above, I can identify the variable clearly used so confusion is avoided. The lower case use of variable is just a string. It is not a concept from the book of cmd scripting (if the book even exists) but it is simply a concept that I choose to use.

:)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...