VMware Horizon Community
Ray_handels
Virtuoso
Virtuoso

variable not working in argument in shortcut

Hey Guys,

Maybe someone here can help us with the following issue,

We create an environment variable in DEM to see the if a machine is test, production etc.

When we use this variable in the shortcut it works like a charm but when we try to use the same variable in an argument it does not seem to work.

Anyone else seen this issue before??

Regards,

Raymond

5 Replies
DEMdev
VMware Employee
VMware Employee

Hi Raymond,

How exactly are you configuring the environment variable, and how are you referencing it in "an argument"?

0 Kudos
Ray_handels
Virtuoso
Virtuoso

Hey DEMdev

What we do now is that we create a variable (I will call it TEST for reference) that changes a file location for a share based on the last letter of a computer name.

For example if the computer name ends with Q the path is \\server\pathQ and so on.

This way we can create 1 shortcut for multiple file locations that we need to start an application with.

This works quite well with the shortcuts.

In this case the actual application is on the local machine itself but we then try to use that %TEST% variable in the argument to access the application on the specific share and it does not seem to set the value correctly.

0 Kudos
DEMdev
VMware Employee
VMware Employee

Hoi Raymond,

I understand the use case, but still don't get how exactly you're setting it up, sorry.

How exactly do you create that env var? Does it show up correctly in the output of SET in a command prompt?

0 Kudos
Ray_handels
Virtuoso
Virtuoso

Hey DEMdev

I will try and do my best explaining how we set this up Smiley Happy. Withput screenshots it's kinda hard but will do my best Smiley Happy Smiley Happy.

We use DEM Enviornment variables for this set up.

We have a few different options for filling up the value %TEST%.

So for example

%TEST% is \\servername\folderX is computername ends with X

%TEST% is \\servername\folderY if computername ends with Y

So if you look at the DEM setup the variable is TEST and the value is \\servername\folderY and the condition is computer name ends with Y.

If i then go to a machine where computername ends with Y and I run the %TEST% in  a command prompt it shows \\servername\folderY as the value for that variable.

Am I making a little bit of sense here? I hope I explained it a little bit better.

0 Kudos
DEMdev
VMware Employee
VMware Employee

Hi Raymond,

If i then go to a machine where computername ends with Y and I run the %TEST% in  a command prompt it shows \\servername\folderY as the value for that variable.

So that means that DEM correctly sets the variable.

If you mean that the DEM agent does not expand env vars references in the Arguments field of a shortcut definition, that is correct. However, Windows does that when you invoke the shortcut.

That is, if I define a shortcut as follows:

pastedImage_7.png

it will behave like this:

pastedImage_6.png

Although Arguments is not "pre-expanded" by the DEM agent (unlike the shortcut name, for instance), Windows does that while launching the shortcut's target. As the Command line column in Task Manager shows, it's not Notepad.exe itself that is performing the expansion.