How to "set" an empty environment variable?

I need to set an environment variable with an empty value. How do I do it ( in a batch file) ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

if you set temp to nothing, it disappears.
Moshe072898Author Commented:
I know, I need to overcome this!
Try this in Dos.  It may not be what you want

Set bill=gates


and type set and you should see of course



set bill=

(but prsss the spacebar after the equal sign before you press Enter)

and type set again and you will see


but of course bill is equal to the spacebar whick may not be what you want.
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

en enviroment variable cannot have a NULL value, so either you set it to "space" like dbruntso suggests, or else you cannot do this.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gah.. i meant that as a comment
Moshe072898Author Commented:
Is it specified somewhere that a environment variable can not have an empty string value?
Yes, Every dos programmers manual since version 1.0 or so.
Lets reason here.

A enviroment variable can contain either "something" or "nothing" right?

When an enviroment variable contains "Nothing" it is removed from the enviroment.

Simple, huh? :)
Moshe072898Author Commented:
Well, if the things are like that I don't see a way out here.
I am going to say that there is a way to do it.

Because the environment variable is removed we test for the environment variable.

Try the following batch file.

if "%temp%"=="C:\WINDOWS\TEMP" goto one
echo This is one
if "%first%"==" " goto two
echo This is two
if "%first%"=="" goto end
echo This is three

If you do not have an envrionment variable set for first then you will not see the message This is three.
Moshe072898Author Commented:
Ye, is's easy to define if a variable exists. But I need to PASS AN EMPTY STRING using an environment variable!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.