Saturday snippet: Parsing a file from a batch file


From the 2014 version of setenv.bat, which uses the for command to parse the [new] License.env file.

for /f "delims== tokens=1,2*" %%i in (License.env) do (
	if "%%i"=="SOFTIMAGE_LICENSE_METHOD" (
		set SILicMethod=%%j
	) else if "%%i"=="ADSKFLEX_LICENSE_FILE" (
		set _ADSK_LicServers=%%j
	)
)

License.env is a file that looks something like this:

rem Licensing method: Standalone | MSSA | Network
SOFTIMAGE_LICENSE_METHOD=Network

rem License servers specified from the setup. Format: [port1]@host1[;[port2]@host2]...
ADSKFLEX_LICENSE_FILE=2080@somewhere.someplace.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s