Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does %1#==?# mean? (cross posted)

Status
Not open for further replies.

LesleyW

Programmer
Mar 12, 2001
196
GB
Hi folks, I hope this question belongs here, and that someone can help! I also posted in Microsoft Basic List but really not sure where it belongs. It's urgent, therefore cross posted.

I have the following in a DOS batch file, its an installation script.
Code:
if 	%1#==?#  goto HELP
  if 	%1#==#   goto HELP
  if 	%2#==#   goto HELP
  if 	%ECOMMERCE_ROOTDIR%#==#   goto HELP
It keeps meeting the condition and going to Help, and I don't know why. I am definitely putting in 2 parameters when calling the cmd file, and I've checked that Ecommerce_RootDir environment has a valid value.

Can you please help!
 
Put this in a batchfile:
@echo off
set ECOMMERCE_ROOTDIR=somedir
if %1#==?# echo first variable is ?
if %1#==# echo first variable is empty
if %2#==# echo second variable is empty
if %ECOMMERCE_ROOTDIR%#==# echo the ECOMMERCE_ROOTDIR enviroment is not set (see second line of this batchfile)

if you put rem before the second line the enviroment variable ECOMMERCE_ROOTDIR is not set and the batchfile will say the ECOMMERCE_ROOTDIR enviroment is not set (see second line of this batchfile).
You have to start the batchfile like this:
test.bat %1 %2
or if you do not set the ECOMMERCE_ROOTDIR you can start like this:
set ECOMMERCE_ROOTDIR=somedir
test.bat %1 %2

To see the enviroment variable of ECOMMERCE_ROOTDIR you can give the following command:
SET ECOMMERCE_ROOTDIR
The answer will be(if you ran the batchfile):
ECOMMERCE_ROOTDIR=somedir

Hope this helps.
 
Thank you, the Ecommerce_RootDIr was not set PROPERLY, this was the problem. I figured it out when I laid it out like you showed me above.

Looking at the environment variables using the Set keyword in DOS, I saw
Code:
ECOMMERCE_ROOTDIR = D:\APPLICATIONS\SOMEDIR

but all the other variables had no space on the equals. Got rid of that one and set one with no equals, now it sees the variable, and all is fine.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top