Question Locked

How to use environment variable in windows task scheduler?

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello!

I want to add a task in windows task scheduler (windows server). The problem is, the path of the exe is not fixed. I have created a user variable 'my_exe_path' under environment variables which has the path to the exe.

How do I schedule this exe to run daily? If I use %my_exe_path%\myexe.exe as the program to start in the task, it is not able to find the path.

Any help?

Thanks!!

2 replies

by leonardo_c

Use cmd /c to start the program, this will allow access to variables. ie:
cmd /c start %my_exe_path%\myexe.exe

This discussion is closed to new replies.