I have a batch script, wich runs a seperate .exe from a server within the subnet the executing client is located. Because there are two domains and the servers have different names in each subnet (following a name schema), I use %domain% and %hostname% to build up a localized download string for each client.
Here ist the script, it works perfect if I execute it on a client:
hostname>%temp%\hostname.txt set /p haus=<%temp%\hostname.txt set haus=%haus:~0,4% if %USERDOMAIN% ==firstdomain ( echo \\%haus%servername.firstdomain.local\vert\appname.exe >%temp%\executeme.bat) if %USERDOMAIN% == seconddomian( echo \\%haus%servername.seconddomain.int\vert\appname.exe >%temp%\executeme.bat) %temp%\executeme.bat
So my problem is: When I schedule a batch job only the first two lines are executed. I could figure out that for example the not matching if statement is a problem, here the execution definitly stops. Launching the batch per double click from the clients %programfiles%/landesk/LDClient/sdmache works perfect.
Has anybody an idea where I made a mistake? Maybe batch jobs run different under local system?