ecmastrean
Visitor.
551 views

Edit Text File Action not reproducing double %% in file.

We are running ZENworks Update 3 (17.3) and we have a bundle we have been using for many years (and many editions of ZENworks) that has an action that is not working correctly anymore. The problem is with the "Edit Text File" install action that we are using to create a batch file if it does not exist. The action copies the script but it is not the same as defined in the "Contents of the file:" box in the action. Everything is correct except for where double symbols are used for a variable. For example the correct script as defined in the bundle action is:
ren "*.pgp" "Company_Name_To_InfoArmor_CAD_%date:~10,4%%date:~7,2%%date:~4,2%.csv.pgp"

Notice the bold double "%%" for the date variable.

The script on the computer shows:
ren "*.pgp" "Company_Name_To_InfoArmor_CAD_%date:~10,4%date:~7,2%date:~4,2%.csv.pgp"

Just for testing purposes I added the bogus line to the end of the code in the bundle:
C:Windows\%%win20.rtd%%

What gets copied to the computer is:
C:Windows\%win20.rtd%

I have tried different encodings such as ASCII, Unicode, UTF-8 and Auto detect. I have run the action as User and System.

I will admit there are better ways of copying a script to a computer, such as using the "Install File(s)" action. We just noticed this problem a few weeks ago when we needed to make a change to the text file. So I wanted to ask if anyone else has seen this problem and if there is a fix.
Labels (1)
0 Likes
3 Replies
Micro Focus Expert
Micro Focus Expert

Re: Edit Text File Action not reproducing double %% in file.

AFAIK, The current behavior seems to be the same since ZCM 11.2.0.
There is a TID that will be complete Gibberish....but marks the last time it was updated.
(Note: The Internal Notes and the bug it links to actually makes sense....just the TID Author did not do a great job of relaying info....So expect the TID to be updated...)

When there are multiple %%s, you may need to escape them depending on your desired results.


For Example if I were to create a text action that created these 3 lines:
%windir%
%%windir%%
\%\%windir\%\%

The Result would be the following:
C:\Windows
%windir%
%%windir%%

--

So you would want the following....

ren "*.pgp" "Company_Name_To_InfoArmor_CAD_%date:~10,4\%\%date:~7,2\%\%date:~4,2%.csv.pgp"
--
Please give a hearty thumbs up to any post you find helpful!
To find articles by Craig Wilson simply follow the link: Craig Wilson's Tips!
0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Edit Text File Action not reproducing double %% in file.

Oh the Gibberish TID is ....
https://support.microfocus.com/kb/doc.php?id=7008716

I will be updating it shorty....
--
Please give a hearty thumbs up to any post you find helpful!
To find articles by Craig Wilson simply follow the link: Craig Wilson's Tips!
0 Likes
ecmastrean
Visitor.

Re: Edit Text File Action not reproducing double %% in file.

Thanks Craig for the information and the TID. Your suggestion worked:
ren "*.pgp" "Company_Name_To_InfoArmor_CAD_%date:~10,4\%\%date :~7,2\%\%date:~4,2%.csv.pgp"

I didn't know \%\%windir\%\% = %%windir%%. We will document this for future reference. Thanks again.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.