in reply to PAR packaging and Windows scheduled tasks

The PAR executable unpacks the Perl files into a directory below $ENV{TEMP} - is this variable set when your scheduled task runs and does the user the task runs as have the appropriate permissions to create the directory and files there?

I think there is a swithc or an environment variable that makes PAR retain the unpacked files in the temp directory. Maybe if you enable that, you find remnants of the attempted run.

Replies are listed 'Best First'.
Re^2: PAR packaging and Windows scheduled tasks
by ice94 (Novice) on Jan 06, 2016 at 13:55 UTC
    Thanks for your answer, I'll look into it.

    However, let me add a few things to my original diagnosis:
    - the executable is not started when defined in a scheduled task, even if I add the .exe location dir to the option "Start in"
    - if I create a .bat file w/ the code below and call it directly in a scheduled task, it works as intended:
    set "WDIR=c:\my_app\" c: cd %WDIR% my_app.exe exit
    I am puzzled...

      Maybe the real path you use contains whitespace and the link in the Task Scheduler does not contain the appropriate double quotes? But the same should apply to the .bat file, so I'm not really sure where/why the problem is there as well.

      Does your PAR program expect to be able to write to STDOUT? It might be that Windows does not allocate a console for the program, but allocates one for cmd.exe, which your PAR program then inherits.

        OK, I think I definitely narrowed it down to a whitespace issue. Here is my diagnosis regarding the settings of the scheduled task:

        Install path: "C:\Program Files (x86)\my_app\"

        -no specified default start path: did not work
        -specified "C:\Program Files (x86)\my_app\" as the default start path: did not work

        Install path: "C:\temp\my_app\"

        -no specified default start path: did not work
        -specified "C:\temp\my_app\" as the default start path: worked

        Install path: "C:\dir with spaces\my_app\"

        -no specified default start path: did not work
        -specified "C:\dir with spaces\my_app\" as the default start path: did not work

        I am still confused as to why the given start path does not work if it contains whitespaces BUT is enclosed in double quotes...


        UPDATE:

        Install path: "C:\Program Files (x86)\my_app\"

        -no specified default start path: did not work
        -specified "C:\Program Files (x86)\my_app\" as the default start path: did not work
        -specified C:\Program Files (x86)\my_app\ (i.e. same as above but w/o the double quotes) as the default start path: worked