rem Try to move/delete the file silently to avoid deleting locked files move /y…
- User
rem Try to move/delete the file silently to avoid deleting locked files move /y "R:\Temp%%F" "R:\Temp%%F" >nul 2>&1 && del /f /q "R:\Temp%%F" >nul 2>&1
this is happening in a 5 minute loop, i want a way to tell that is working from the batch output, can you device a simple way to show that it is working, i don't know if you can show a last run without shitting up the screen or perhaps a series of dots is nicer to come back after a few hours and see that it has either been working or not , no files,just dot for movable and das for deleted.
Assistant
Here are a few clean ways to show the script is working:
Option 1: Simple dots and dashes (your preference)
rem Try to move/delete the file silently to avoid deleting locked files move /y "R:\Temp\%%F" "R:\Temp\%%F" >nul 2>&1 if errorlevel 1 ( echo|set /p="." ) else ( del /f /q "R:\Temp\%%F" >nul 2>&1 echo|set /p="-" )Option 2: Dots with occasional timestamp
rem Try to move/delete the file silently to avoid deleting locked files move /y "R:\Temp\%%F" "R:\Temp\%%F" >nul 2>&1 if errorlevel 1 ( echo|set /p="." ) else ( del /f /q "R:\Temp\%%F" >nul 2>&1 echo|set /p="-" ) rem Show timestamp every 20 operations (adjust as needed) set /a counter+=1 if !counter! geq 20 ( echo. echo [%time%] set counter=0 )Option 3: Single updating line with stats
rem Try to move/delete the file silently to avoid deleting locked files move /y "R:\Temp\%%F" "R:\Temp\%%F" >nul 2>&1 if errorlevel 1 ( set /a locked+=1 ) else ( del /f /q "R:\Temp\%%F" >nul 2>&1 set /a deleted+=1 ) rem Update same line echo|set /p="Working... Locked: !locked! Deleted: !deleted! [%time:~0,8%] "The first option gives you exactly what you wanted - dots for files that can't be moved (locked) and dashes for files that get deleted. You'll see a stream like
...--.-.--...that shows activity at a glance.- User
why can't this work, i dont want to use if statements
move /y "R:\Temp%%F" "R:\Temp%%F" >nul 2>&1 && <nul set /p=. && del /f /q "R:\Temp%%F" >nul 2>&1 && <nul set /p=-
Assistant
Your command has a logic issue. With
&&chaining, if the move fails (file is locked), the chain stops and nothing gets printed.Try this instead:
move /y "R:\Temp\%%F" "R:\Temp\%%F" >nul 2>&1 && (del /f /q "R:\Temp\%%F" >nul 2>&1 && <nul set /p=-) || <nul set /p=.This works because:
- If
movesucceeds → delete file and print- - If
movefails → the||kicks in and prints.
The parentheses group the delete and dash-printing together so they're treated as one unit in the chain.
- If
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.