G
gary
(Had posted this in microsoft.public.windows.server.scripting but thought
mayube it would be better here. If anyone thinks there is a better forum to
post this in, please indicate. Thanks.)
Hello. I have a batch file that we'd like to run as a service so that it
runs before a user logs on. I have used Iexpress to wrap the BAT file into
an EXE, and used instsrv and srvany to create a service.
The problem is that the BAT file contains environment variables. When I run
the bat at the command prompt, it runs fine. But when I run the EXE created
by iexpress, it fails because none of the environment variables defined in
the BAT file are getting set..
Is there a way to have the EXE file created by iexpress preserve the
environment variables which are getting set in the BAT file?
A test batchfile I've created looks like this.
cd \servic~1
set fulltime=%time: =0%
set tm=%fulltime:~0,2%%fulltime:~3,2%%fulltime:~6,2%
set dt=%date:~10,4%%date:~4,2%%date:~7,2%
set var=%dt%%tm%
echo %var% > %var%.txt
exit
When this file runs as an EXE, all the env variables are set to blank, and
the testfile (%var%.txt) never gets created. When I run that BAT file, it
works fine.
Thanks.
mayube it would be better here. If anyone thinks there is a better forum to
post this in, please indicate. Thanks.)
Hello. I have a batch file that we'd like to run as a service so that it
runs before a user logs on. I have used Iexpress to wrap the BAT file into
an EXE, and used instsrv and srvany to create a service.
The problem is that the BAT file contains environment variables. When I run
the bat at the command prompt, it runs fine. But when I run the EXE created
by iexpress, it fails because none of the environment variables defined in
the BAT file are getting set..
Is there a way to have the EXE file created by iexpress preserve the
environment variables which are getting set in the BAT file?
A test batchfile I've created looks like this.
cd \servic~1
set fulltime=%time: =0%
set tm=%fulltime:~0,2%%fulltime:~3,2%%fulltime:~6,2%
set dt=%date:~10,4%%date:~4,2%%date:~7,2%
set var=%dt%%tm%
echo %var% > %var%.txt
exit
When this file runs as an EXE, all the env variables are set to blank, and
the testfile (%var%.txt) never gets created. When I run that BAT file, it
works fine.
Thanks.