Need help to run an exe without an open session

LinSkeZ -  
 LinSkeZ -
Hello,

I am stating my problem. I created an Excel macro that opens files, processes them, creates a summary file that then saves itself instead of being prompted in the macro.
Now that I have done this, I want to schedule its launch every week, on a specific day at a certain time. The issue is that there will be very few times when the session is open for security reasons.

Is it possible to run a .bat file that executes Excel and the macro without a session being open on the machine?

Best regards,

LinSkeZ.

2 answers

jee pee Posted messages 31857 Registration date   Status Moderator Last intervention   9 971
 
Hello,

This is typically a scheduled task: https://www.malekal.com/les-taches-planifiees-de-windows/. But does Excel allow running in batch mode without a graphical interface?

And do you already have a .bat file that launches Excel and runs your macro without intervention?

0
LinSkeZ
 
My .bat runs everything without human intervention; everything is automatic. I have created a scheduled task, but I need to set it up on a remote computer (server) that will rarely have a session open.
I'm currently trying to schedule it from my workstation, but my task starts (I'm not sure if I'm using the correct user), yet nothing executes when I close my session.

I'm not sure if I'm being very clear.
0
jee pee Posted messages 31857 Registration date   Status Moderator Last intervention   9 971 > LinSkeZ
 
You should start with a simple test, without Excel.

For example, a .cmd file that contains
echo %time% >>D:\time.txt


Then create a scheduled task: Task Scheduler
- Create a basic task
- Name it
- Trigger set to daily, in 5 minutes
- Action: start a program
- Script: provide the afftime.cmd created with the above command (if you have a D: drive)
- Next
- Check "open the advanced properties..." + Finish
- Check "Run whether the user is logged on or not"
- Check: Run with highest privileges
- Provide the user's password

Verify that the task exists, in "Task Scheduler Library" (left column at the top)

Log off. Following this procedure, my task runs correctly even when I'm not logged in.
0
LinSkeZ > jee pee Posted messages 31857 Registration date   Status Moderator Last intervention  
 
I see, I will test all that, I had created a task, not a "base" task, it might come from there.
I will go try all that.
Thank you very much for your answers.
0
LinSkeZ > jee pee Posted messages 31857 Registration date   Status Moderator Last intervention  
 
I followed your advice by trying to simply launch Notepad, but when I log in with a session, the task runs but Notepad doesn't appear on the desktop. When I open my task manager, I can see that Notepad is indeed running, but only as a background process. Is it possible to launch it as a regular program?

Let me explain, when Notepad is launched by the task, is it possible for me to have an open Notepad on my desktop upon logging into my session as a result of my task execution?
0
jee pee Posted messages 31857 Registration date   Status Moderator Last intervention   9 971 > LinSkeZ
 
Scheduled tasks are primarily batch processes, and do not require a graphical interface. Here, Notepad is not associated with your session, which did not exist as it was not open.
0
jee pee Posted messages 31857 Registration date   Status Moderator Last intervention   9 971
 
But does Excel accept to run in batch mode without a graphical interface?

Because the purpose of batch tasks is to start, execute, and finish without a screen and without intervention.
0
LinSkeZ
 
Hmm I see, I'm going to dig into that. But if Excel can run without a graphical interface, that would mean it's possible to run my macro in the background and without a session. That would be great!

Thanks for your time anyway.
0