I need to copy a file if exist to a list of destinations. The Destination contain %variables%
. When I run it appears to be using the %appdata% as stated in the array list instead of the c:UsersNAMEAppdataroaming
How can I make it use the variable in the array list?
The lnk and the Shortcut_Locations.txt are located in same folder as script.
@echo off
pushd "%~dp0"
set source_file=App1.lnk
set destination_list=Shortcut_Locations.txt
for /f "tokens=*" %%I in (%destination_list%) do (
if exist "%%I" (
copy /Y "%source_file%" "%%I"
)
)
POPD
Shortcut_Locations.txt content
\server1data\%username%Desktop\
%appdata%OpenShellPinned\
%appdata%OpenShellPinnedGGHC\