ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
198 stars 153 forks source link

win_shortcut: Unexpected behaviour when referring to non-existing env-variable #485

Open wfmw445 opened 1 year ago

wfmw445 commented 1 year ago

Since deploying to Win11: When I add a src path with an env-variable which doesn't pre-exist (but will be existing later on the target) it creates a wrong target in the shortcut

OS / Environment Win11

Steps to Reproduce - name: Create a shortcut for the Test community.windows.win_shortcut: description: Test src: '%APP_PATH%\Bin\Edit.exe' dest: '%Public%\Desktop\Test.lnk' arguments: '"%ALLUSERSPROFILE%\AutoTest\Test\AutoTest.lst"' directory: '%ALLUSERSPROFILE%\AutoTest\Test'

Expected Results A shortcut with the following target property:

Target: %APP_PATH%\Bin\Edit.exe "C:\ProgramData\AutoTest\Test\AutoTest.lst

Actual Results Target: C:\%APP_PATH%\Bin\Edit.exe "C:\ProgramData\AutoTest\Test\AutoTest.lst

Somehow 'c:\' inserted before env-variable