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 (
		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

rem License servers specified from the setup. Format: [port1]@host1[;[port2]@host2]...

Putting a customized setenv.bat in a deployment

You can’t actually customize setenv.bat (or any of the other files in the distribution) when you create a deployment, but you add a SiteDeploy.bat file to the install. setenv.bat is set up to call SiteDeploy.bat:

rem Verify the existence of the SiteDeploy.bat file
if exist "%XSI_BINDIR%\SiteDeploy.bat" call "%XSI_BINDIR%\SiteDeploy.bat"

To add a SiteDeploy.bat file to a deployment, you need to configure the Softimage deployment:

In the Additional Files section, expand Application\bin, and then click Browse to locate the SiteDeploy.bat file (which must exist somewhere already):

Setting workgroups at startup

Here’s a simple, low-tech way to connect to specific workgroups at startup:

Instead of xsibatch -w or xsi -w, you could modify setenv.bat to create another .xsipref file in %XSI_USERHOME%\Data\Preferences. Whatever is in that file will override what is in default.xsipref.

So, for example, you could do this:

echo data_management.workgroup_appl_path	= C:\Users\blairs\MyWorkgroup >  %XSI_USERHOME%\Data\Preferences\workgroups.xsipref

or you could use an environment variable:

echo data_management.workgroup_appl_path	= %MY_XSI_WORKGROUPS%  >  %XSI_USERHOME%\Data\Preferences\workgroups.xsipref

This does require you to edit setenv.bat, which isn’t so useful if you have a lot of seats. In that case, if you use a network deployment, you could deploy a %XSI_BINDIR%\SiteDeploy.bat file and use that to echo out the workgroup preference.