Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.

I am trying to assign a file name to a variable.
If I use the task "List Files" and limit it to 1 result, the file name is placed in the output for that task.
How do I get that "file name" assigned to a job variable (or user variable) so that I can use it for next task as an argument for a perl script or batch command execute task?
Please help me?😕
Forum information
The output of previous Task is stored in {TASK(PrevTask|StdOut)}
Please like  VisualCron on facebook!
David Finkelstein
Problem with this is often that same data needs to be used later in the job and you need to assign to a variable. Sure it can be done but it would be nice not to have to add another task to accomplish something like this.
Xander Meadow
Can you use the Direct ID option when grabbing the variable, instead of PrevTask|StdOut? So it would look more like {TASK(<some large alphanumerical string>|StdOut)} and then use that variable multiple times throughout the rest of your job? That value should not change as you progress through your job in the way PrevTask|StdOut will. HTH.

Actually, I'm pretty sure it CAN change, if the job is allowed to run while it is already running. I think this is related to your problem in your other thread.
Joey S
if Task #1 is List Files and that Output is a single file (or you make it that way)
then Task #2 is Set Job Variable
in that task - under Set Job Variable : Name/Unique Key = whatever you want.. Let's pretend you call it "My_variable"
I suggest no spaces or weird characters and underscores if needed.

Your "value" would be {TASK(PrevTask|StdOut)}
-obviously, at this point Task #2 has to directly proceed Task #1

Make sure to set your Job (at the top) as the job name you are in.

That variable exists only inside of that job and cannot be used elsewhere and will be that initial value until you change it.
Alternatively Task #2 could be Set User Variable. That variable could be used across all jobs or even for other jobs on other VC servers on your network.

Scroll to Top