tags:

views:

141

answers:

2

Hi I Have An App Thats In C# That Sets User Environment Variables

PCManufacturer PCModel

I Need To Be Able To Read The Values From Them Varibles In A Batch File How Do I Do This?

I Have Tried %PCManufacturer% & %PCModel% But They Didn't Work!!

+1  A: 

Go to a command prompt and execute the SET command. Verify that PCManufacturer and PCModel are in the list, and that they are set to actual values.

Robert Harvey
Yes There In ListPCManufacturer=AcerPCModel=TravelMate 2480
OK, now run the following command:"ECHO %PCModel%"It should have replied with "TravelMate 2480"
Robert Harvey
Ok Its Working Now How Do I Compare Them?IF %PCModel%==Dimension 2400 ECHO Using A Dellis that right?
If the string you are comparing has a space in it, you must surround it with quotes. IF %PCModel%=="Dimension 2400" ECHO "Using A Dell"
Robert Harvey
Robert Harvey: In that case you also need to surround the %PCModel% with quotes. Also the quotes for echo are unnecessary and get output as well. Echo is a shell-builtin and doesn't follow the rules for C programs.
Joey
+1  A: 

c_workman:

As a follow-up, this web page should prove valuable:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/batch.mspx?mfr=true

Robert Harvey