RENAME /P
If you want to end a RENAME /P command with <Esc>, you get some pretty strange behaviour:
If it is a filename without spaces, RENAME ignores <Esc> and asks again for Y/N/A/R.
If it is a filename with spaces, things get really interesting: it seems that the quotes around the filename are ignored and the filename is considered as multiple filenames.
COPY /P, DEL /P and MOVE /P work as one would expect: the command gets terminated.
KEYSTACK
In further testing I used KEYSTACK for replaying. KEYSTACK is supposed to begin with a clean buffer (between multiple KEYSTACK commands). This was not the case...
In the testscript below you can activate the
command to see the different effect it has on the second RENAME command.
( Tested on TCC/LE 14@Windows 7 SP1 )
TESTSCRIPT
TESTSCRIPT OUTPUT
If you want to end a RENAME /P command with <Esc>, you get some pretty strange behaviour:
If it is a filename without spaces, RENAME ignores <Esc> and asks again for Y/N/A/R.
If it is a filename with spaces, things get really interesting: it seems that the quotes around the filename are ignored and the filename is considered as multiple filenames.
Code:
[C:\Temp\ff]ren /p "test1 test2 test3.txt" "abc.txt"
C:\Temp\ff\test1 test2 test3.txt -> C:\Temp\ff\abc.txt (Y/N/A/R)?
TCC: (Sys) The system cannot find the file specified.
"C:\Temp\ff\test1"
TCC: (Sys) The system cannot find the file specified.
"C:\Temp\ff\test2"
TCC: (Sys) The system cannot find the file specified.
"C:\Temp\ff\test3.txt"
0 files renamed
COPY /P, DEL /P and MOVE /P work as one would expect: the command gets terminated.
KEYSTACK
In further testing I used KEYSTACK for replaying. KEYSTACK is supposed to begin with a clean buffer (between multiple KEYSTACK commands). This was not the case...
In the testscript below you can activate the
Code:
rem set KeySequence=Esc "N"
( Tested on TCC/LE 14@Windows 7 SP1 )
TESTSCRIPT
Code:
@echo off
setlocal
alias SHOWVAR=`echo. %@UPPER[%1] : %[%1]`
echo.========================================================
ver /r
echo.
echo.========================================================
pushd "%~dp0"
:: TEST1
echos.>"dummy file name.txt"
set KeySequence=Esc
rem for testing keystack buffer flush:
rem set KeySequence=Esc "N"
gosub :TRY_RENAME
:: TEST2
rem start /wait /C echos.> "dummy" > "file" > "name.txt"
for %x in ("dummy" "file" "name.txt") Do echos.> %x
set KeySequence=/W3 Esc /W3 "N" "N" Esc "N" "N" "N"
gosub :TRY_RENAME
:: DONE
del /q "dummy file name.txt" "dummy" "file" "name.txt"
goto :EOF
:TRY_RENAME
echo.
dir /hkm
echo.
echo.========================================================
echo.
SHOWVAR KeySequence
echo.
keystack %KeySequence% & ren /P "dummy file name.txt" "abc.txt"
echo.
echo.========================================================
RETURN
TESTSCRIPT OUTPUT
Code:
========================================================
TCC LE 14.00.9 x64 Windows 7 [Version 6.1.7601]
TCC LE Build 9 Windows 7 Build 7601 Service Pack 1
========================================================
2-09-2016 17:39 0 dummy file name.txt
2-09-2016 13:57 973 test.btm
========================================================
KEYSEQUENCE : Esc
C:\Temp\ff2\dummy file name.txt -> C:\Temp\ff2\abc.txt (Y/N/A/R)?
TCC: (Sys) C:\Temp\ff2\test.btm [45] The system cannot find the file specified.
"C:\Temp\ff2\dummy"
TCC: (Sys) C:\Temp\ff2\test.btm [45] The system cannot find the file specified.
"C:\Temp\ff2\file"
TCC: (Sys) C:\Temp\ff2\test.btm [45] The system cannot find the file specified.
"C:\Temp\ff2\name.txt"
0 files renamed
========================================================
2-09-2016 17:39 0 dummy
2-09-2016 17:39 0 dummy file name.txt
2-09-2016 17:39 0 file
2-09-2016 17:39 0 name.txt
2-09-2016 13:57 973 test.btm
========================================================
KEYSEQUENCE : /W3 Esc /W3 "N" "N" Esc "N" "N" "N"
C:\Temp\ff2\dummy file name.txt -> C:\Temp\ff2\abc.txt (Y/N/A/R)?
C:\Temp\ff2\dummy -> C:\Temp\ff2\abc.txt (Y/N/A/R)? N
C:\Temp\ff2\file -> C:\Temp\ff2\abc.txt (Y/N/A/R)? N
C:\Temp\ff2\name.txt -> C:\Temp\ff2\abc.txt (Y/N/A/R)?
C:\Temp\ff2\dummy -> C:\Temp\ff2\abc.txt (Y/N/A/R)? N
C:\Temp\ff2\file -> C:\Temp\ff2\abc.txt (Y/N/A/R)? N
C:\Temp\ff2\name.txt -> C:\Temp\ff2\abc.txt (Y/N/A/R)? N
0 files renamed
========================================================