|I've got a tricky situation. I have a batch file that uses %clientname% to set the environment variable for CLIENTNODE and then launches an app (this is in a Terminal Service setup).|
Basically script starts like this:
net use y: \\fileserver\share
setX clientnode %clientname%
Setx CLIENTNODEPATH Y:\Common
and the script goes on to do other stuff and eventually launch an application. The reaon for this is because I'm basically emulating a PC name in the TS environment, because within that application, a "NODE" is configured and has to match a certain machine name.
This all worked great, UNTIL they stopped inputting the "NODE" within the application to match the pc name (%clientname%).
For the life of me I can't seem to figure out how make the batch file read another file, i.e. a txt file located on \\fileserver\share, and then when it finds a match for the %clientname%, use variable X or whatever.
So for example, if I had a text file that could be maintained like:
So in the example, LABTESTPC-10 is the pc name, but LBTST10 is the "NODE" name in the application.
Is there a way I can take my original .bat file and make it read the text file located on the share, and if their %clientname% is matching the first column, i.e. LABTESTPC-10, then have a variable that gets plugged into the 'setx CLIENTNODE=X, where X is obviously the second column of the same line of the text file, i.e. LBTST10.
I have spent a LOT of time trying to figure it out, but everything I attempted fell short so I thought I would just reach out to someone who is more versed with scripting to see if it's even possible to make this work. Then the enduser in charge of the app just has to maintain the text file, so when a new NODE is added to the app, they just need to fill in the pc name and then the NODE name.