Question cmd file issues

Aug 12, 2024
18
0
10
Hi everyone.
I am newbie and asking for some help on defining a cmd file with log file, I have the issue that sometimes I need to click five times on the file to get it executed from shortcut.

Here is the file content, first block is a copy and paste from internet as I was looking for a log.
Remaining code is for killing onedrive as it creates sync issues and after run two backup programs in WSL.

for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (
set dow=%%h
set month=%%i
set day=%%j
set year=%%k
)
SET datestr=%month%_%day%_%year%
SET path=C:\Log\
SET filename=%path%log-%datestr%.txt
echo ==LOG FILE %datestr% == > %filename%
taskkill /IM onedrive.exe || WSL rclone sync /mnt/d/filesbatch1 remote:Backup1 -v -P ^&^& WSL rclone sync remote:Folder /mnt/d/filesbatch2 -v -P

Thank you.