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


jsmith@certipay.com
2012-11-27T22:25:39Z
My understanding is that system-level environment variables are only available to tasks that execute as foreground tasks (e.g. log in as a user). This presents a problem when attempting to use the FTP task that references environment variables to determine paths.

The only alternative that seems managable (though not as desired) is to set up custom variables in Visual Cron

Is there anyway use environment variables in FTP tasks? What alterneratives are there if this is the case?

Thanks,

Jeremy

Sponsor
Forum information
bbusse
2012-11-28T14:56:14Z
EDIT: i'm not going to remove my post, but i feel like an idiot. 🙂 You obviously put GETENV in your post title... so you're using what I mentioned already.
=========================================

When you say "system-level environment variables" are you talking about things like %COMPUTERNAME% as though you were using a batch file on the command prompt? Or the VisualCron variables that are available to you already?

The 'System Variables' are available to you by way of the Visualcron Variable syntax. Just posting this as an example in case this is not what you've tried already. See Screenshot.

The variable below will get you the 'PATH' variable, PATH can be replaced by other system variables such as TMP, TEMP, COMPUTERNAME, etc...:


{GETENV(PATH)}


Brian
bbusse attached the following image(s):
jsmith@certipay.com
2012-11-28T15:05:23Z
😁

Yes, I'm using the GETENV (with success) when switching to foreground tasks, but some tasks do not have the option.
jsmith@certipay.com
2012-11-28T15:36:15Z
In the meantime, I set up the variables as Visual Cron user defined variables. Since the variables are server-specific, this falls in line with my requirements. Only issue with this is the environment variables wouldn't be avialable to other applications on the server (that don't interface with VisualCron).

My solution to this was to create a Environment Variable Sync job that writes the VisualCron variables to the system environment variable registry path (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment). This has to be followed by a reboot so I'm experimenting with using the shutdown trigger as well as setting a dependency on a seperate, existing, reboot job.
bbusse
2012-11-28T15:46:18Z
You might want to try the SetX command. I have it on my 2008 Server, though i'm not sure if its becuase I installed any addons. It was originally part of the Windows 2000 Resource Kit, but might be built in now.


NOTE: 1) SETX writes variables to the master environment in the registry.

2) On a local system, variables created or modified by this tool
will be available in future command windows but not in the
current CMD.exe command window.

3) On a remote system, variables created or modified by this tool
will be available at the next logon session.

4) The valid Registry Key data types are REG_DWORD, REG_EXPAND_SZ,
REG_SZ, REG_MULTI_SZ.

5) Supported hives: HKEY_LOCAL_MACHINE (HKLM),
HKEY_CURRENT_USER (HKCU).

6) Delimiters are case sensitive.

7) REG_DWORD values are extracted from the registry in decimal
format.

Brian
jsmith@certipay.com
2012-11-28T15:54:34Z
Hmmm...I'll have to look into that.

I'm hoping to avoid adding any additional dependencies for the server configurations.
bbusse
2012-11-28T16:08:38Z
Originally Posted by: jsmith@certipay.com 

Hmmm...I'll have to look into that.

I'm hoping to avoid adding any additional dependencies for the server configurations.



I completely agree. I avoid installing anything 3rd party as a matter of principle. :)
I'm a big fan of native code. Of course, sometimes it can't be avoided, though I go kicking and screaming. haha

Brian
Scroll to Top