Community Forums
Page 1 of 2 12 LastLast
Results 1 to 5 of 7

Thread: Windows Task Scheduler not seeing New System Environment Variable...

  1. #1
    Join Date
    Jul 2004
    Location
    New York, New York
    Posts
    385

    Wink Windows Task Scheduler not seeing New System Environment Variable...

    The Installation creates a new system environment variable (no reboot required). If I open a new CMD prompt I can see the new environment variable present, but if I create a scheduled job/task (batch file) and then it runs, the batch file does not see the new system environment variable!

    The Task Scheduler has access to all the System Environment Variables. But for some reason the Task Scheduler does not see new System Environment Variables right away. The machine needs to be rebooted.

    I’ve tried to stop and start the "Task Scheduler" service through Services, and this did not help.

    Therefore, after the software installation which creates new system environment variables, the machine must be rebooted if we want the Task Scheduler to see the new system environment variables.


    Have you guys seen this symptom?
    Any ideas on how to fix this without a reboot?


    Code:
    C:\>AT.EXE /?
    The AT command schedules commands and programs to run on a computer at
    a specified time and date. The Schedule service must be running to use
    the AT command.
    
    AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
    AT [\\computername] time [/INTERACTIVE]
        [ /EVERY:date[,...] | /NEXT:date[,...]] "command"
    
    \\computername     Specifies a remote computer. Commands are scheduled on the
                       local computer if this parameter is omitted.
    id                 Is an identification number assigned to a scheduled
                       command.
    /delete            Cancels a scheduled command. If id is omitted, all the
                       scheduled commands on the computer are canceled.
    /yes               Used with cancel all jobs command when no further
                       confirmation is desired.
    time               Specifies the time when command is to run.
    /interactive       Allows the job to interact with the desktop of the user
                       who is logged on at the time the job runs.
    /every:date[,...]  Runs the command on each specified day(s) of the week or
                       month. If date is omitted, the current day of the month
                       is assumed.
    /next:date[,...]   Runs the specified command on the next occurrence of the
                       day (for example, next Thursday).  If date is omitted, the
                       current day of the month is assumed.
    "command"          Is the Windows NT command, or batch program to be run.
    
    
    C:\>AT.EXE
    There are no entries in the list.
    
    C:\>AT.EXE 13:00 /next: C:\foo\test.bat
    Added a new job with job ID = 1
    
    C:\>AT.EXE
    Status ID   Day                     Time          Command Line
    -------------------------------------------------------------------------------
            1   Next 13                 1:00 PM       C:\foo\test.bat
    
    C:\>
    Last edited by Perucho; 05-13-2005 at 10:43 AM.

  2. #2
    Join Date
    Jun 2004
    Location
    Waltham, MA
    Posts
    94
    Have you tried sending a WM_WININICHANGE using SendMessage? Example here

  3. #3
    Join Date
    Jul 2004
    Location
    New York, New York
    Posts
    385

    Wink Windows Task Scheduler not seeing New System Environment Variable...

    Actually the new system environment variables are being created by a Universal Project installation. I don't know if this is true for a InstallScript Project installation (I will test this!).
    In any case after noticing this symptom I attemped to reproduce the problem manually. I created a new system environment variable (manually) through "System Properties" and then created a task. I discover that the "Task Scheduler" does not see new System Environment Variables right away. The machine needs to be rebooted.

    Adding/Creating Environment Variables on Windows:
    System Properties --> Advanced tab --> Environment Variables...

    Has anyone seen this before?

    Whirtee: I will try your idea once I find out how to send a WM_WININICHANGE using SendMessage() with Java for a Universal Project. I would think InstallShield will do this automatically for you?
    Last edited by Perucho; 05-19-2005 at 11:11 AM.

  4. #4
    Join Date
    Jan 2005
    Posts
    101
    I had this problem in the past, and it seems the only reliable way to get all applications to recognize the new environment is to reboot the PC.

  5. #5
    Join Date
    Jun 2004
    Location
    Waltham, MA
    Posts
    94
    Hmmmm not sure if you can do it manually, might require a VBscript or native app. I have to create and run a VBscript in my universal installer to find the list of currently running processes, not very nice but the only way I can find.

    Secondly, you shouldn't need a full reboot, just log out and back in. Still annoying, but less time-consuming.

    Owen.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •