Script: 

```
pushd "\\server1\share\Data\"
for %%p in (*.pdf) do if /i ".pdf"=="%%~xp" for /f "tokens=1 delims=_" %%n in ("%%~np") do ( 
    copy "%%~fp" ""\\server2share\data\%%~n\%%~nxp" dir >> \\server\share\logfile.txt

)

```

I want to log the output everytime this command runs. The script copies pdf's based on name. But when i run the script. No log file is created.