1 for /f "tokens=2,*" %%i in ('reg query "HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v "Desktop"') do ( 2 set desk=%%j 3 ) 4 date/t >>%desk%log.txt 5 time/t >>%desk%log.txt 6 ping -n 5 192.168.1.1 >>%desk%log.txt 7 time/t >>%desk%log.txt 8 start %desk%log.txt 9 exit