cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Botzal
Level III

How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

Hi All,

I'm trying to run batch file automatically every day when radio button -"run whether user is logged on or not"  is selected and it doesn't work.
It works only when radio button "run with the user logged on" is selected.
Can you advise please?

Thank you

13 REPLIES 13
Botzal
Level III

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

Correct.
The script run and generates output when the "Run only when user is logged on" is selected,
and it is does not work when the "Run whether user is logged in or not" is selected.
In both options I start the task manually.

Botzal
Level III

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

Hi @ih ,

I was able to run the above simple script automatically when the button "Run whether the user is logged on or not"  was selected.
The solution to run it - I added /k in Task Scheduler - see below.

Botzal_0-1648626125094.png


But when I try to run a complicated script (pulling data from the server and saving output on the server) It still does not work - It stuck on running status . any advise please?

Thank you

ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

You might add some actions in your script help point you to the parts of your script that do not work. For example, you could add lines like this throughout your script:

 

Save Text File( "$TEMP/RunStatus - Finished defining functions.txt", "")
Save Text File( "$TEMP/RunStatus - Starting to download data.txt", "")
Save Text File( "$TEMP/RunStatus - Downloading data and starting transformations.txt", "")
WebDesignesCrow
Super User

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

Hi @Botzal ,

I'm not sure what you are trying to do with both cmd & jmp file running at the same time.

I able to run my script during user log out/in at specific time will below flow;

-> Task scheduler run my JSL script run at specific time

-> the .jmp script open a cmd file (for IT to do some copy/paste JMP Results from local PC to intranet server)

 

//call IT cmd to copy the files to intranet server
RP = run program(
	Executable ("C:\ScriptJMPAutomation\MoveJMPFile.exe")
);
//set no save for auto taskscheduler
exit(nosave);

-> .cmd file close after running its script & .jmp file exit with no save.

 

The task scheduler .jmp will still show running unlimited time if I click it to manual run through Task Scheduler.

So I forced it to stop after 1 hour through the task scheduler setting.

WebDesignesCrow_0-1648705981521.png

Can check back the results after the "1 hour" done. It will show as "ready".

My report ready to view the next morning even though the PC is log-off during the script running.

I'm not sure if this is helpful but just to share how I did it. 

Maybe you can also read below link for details.

https://docplayer.net/48888365-Syntax-overview-let-s-start-with-the-syntax-of-run-program.html