On Thu, 2 Nov 2006 15:18:34 -0500, "Tom Porterfield"
<(E-Mail Removed)> wrote:
Interesting thing, I took that same test home, changed the computer
name and the test worked. Something is different between the two
computers (besides the name).
>Howard Brazee wrote:
>> On Thu, 2 Nov 2006 12:56:08 -0500, "Tom Porterfield"
>> <(E-Mail Removed)> wrote:
>>
>>> Take ths space out and you have it. The variable from batch is
>>> %COMPUTERNAME%.
>>
>> That worked. But do you know what's wrong here?
>> set MYTEST="xxx"
>> if "%COMPUTERNAME%"=="BRAZEEXHP" set MYTEST="A"
>> if %COMPUTERNAME%==BRAZEEXHP set MYTEST="B"
>> if "%COMPUTERNAME%"==BRAZEEXHP set MYTEST="C"
>> if %COMPUTERNAME%=="BRAZEEXHP" set MYTEST="D"
>> if %COMPUTERNAME%==BRAZEEXHP MYTEST="E"
>> echo %COMPUTERNAME% "MYTEST=" %MYTEST% "."
>>
>> produces:
>> O:\>set MYTEST="xxx"
>>
>> O:\>if "BRAZEEHXP" == "BRAZEEXHP" set MYTEST="A"
>>
>> O:\>if BRAZEEHXP == BRAZEEXHP set MYTEST="B"
>>
>> O:\>if "BRAZEEHXP" == BRAZEEXHP set MYTEST="C"
>>
>> O:\>if BRAZEEHXP == "BRAZEEXHP" set MYTEST="D"
>>
>> O:\>if BRAZEEHXP == BRAZEEXHP MYTEST="E"
>>
>> O:\>echo BRAZEEHXP "MYTEST=" "xxx" "."
>> BRAZEEHXP "MYTEST=" "xxx" "."
>
>Curious. It runs fine on my machine (changed to match my machinename of
>course) with one exception. if %COMPUTERNAME%==BRAZEEXHP MYTEST="E" has
>incorrect syntax and produces the following error:
>
>'MYTEST' is not recognized as an internal or external command, operable
>program or batch file.
>
>Interesting that you are not seeing that error. I assume the above is in a
>batch file executed via cmd.exe. Is that correct?
|