Copy command to set timestamp not working in TCC/LE

Jan 3, 2017
2
0
What with Windows 10 about get rid of CMD.Exe, I've switched everything to your lovely TCC/LE, thanks for making it!

I have certain batch files that use an obscure copy command to set timestamp of a file:

copy <filename.ext> + <filename.ext> /y

This returns right away in cmd.exe with the only result being the updated timestamp on <filename.ext>. I get a "Contents lost before copy" error with TCC/LE.

Now, this might happen because TCC/LE fixed some sort of copy bug that I've been exploiting for awhile, and I know that I can just download a touch.exe. Reporting it just in case it's a compatibility oversight. Thanks again!
 
May 20, 2008
11,388
99
Syracuse, NY, USA
That doesn't seem to work very well in Win 7's CMD. It adds 1 byte to the file!
Code:
V:\> dir v*
 Volume in drive V is DATA
 Volume Serial Number is C007-D3E4

 Directory of V:\

2017-01-03  20:59                18 var.txt
               1 File(s)             18 bytes
               0 Dir(s)   8,890,716,160 bytes free

V:\> copy var.txt + var.txt /y
var.txt
        1 file(s) copied.

V:\> dir v*
 Volume in drive V is DATA
 Volume Serial Number is C007-D3E4

 Directory of V:\

2017-01-03  21:01                19 var.txt
               1 File(s)             19 bytes
               0 Dir(s)   8,890,716,160 bytes free
 
Jan 19, 2011
604
14
Norman, OK
It adds 1 byte to the file!
You also need to add a /b to the command, otherwise it adds a ctrl-z character.
Code:
C:\temp>dir v*
 Volume in drive C has no label.
 Volume Serial Number is 262B-D729

 Directory of C:\temp

01/04/2017  09:16 AM             1,279 var.txt
               1 File(s)          1,279 bytes
               0 Dir(s)  111,927,558,144 bytes free

C:\temp>copy var.txt + var.txt /y /b
var.txt
        1 file(s) copied.

C:\temp>dir v*
 Volume in drive C has no label.
 Volume Serial Number is 262B-D729

 Directory of C:\temp

01/04/2017  09:16 AM             1,279 var.txt
               1 File(s)          1,279 bytes
               0 Dir(s)  111,927,554,048 bytes free
 
Jan 3, 2017
2
0
Well... wow. Somewhere back in time, the command "copy filename + ," (best as I recall from memory) stopped working as a touch command. I "brilliantly" figured out that copy filename.txt + filename.txt /y /b (my scripts do in fact have a /b switch, oops. edit: more wrongness. no, in fact, they don't. i want to hide under a rock) did the trick. For around 20 years, I have never noticed that it was adding a byte to the file. The files in my batch files are sentinel files for processing data, so their content has always been less important then the timestamp. I apologize for the randomization. The only thing not working properly here. . . is me!
 
Last edited:

rconn

Administrator
Staff member
May 14, 2008
12,340
149
If you use the internal TOUCH command with no time or date:

touch var.txt

it will set the date / time of var.txt to the current date & time.

I'm aware of the undocumented CMD behavior (though IMO it should be classified as a bug, not a feature). Given that it's a more complicated approach than using TOUCH, and that it would hide an error that was more likely the intent, I never deemed it worth duplicating.
 
Similar threads
Thread starter Title Forum Replies Date
keithg1964 How to? copy files and display internal variables TCC/LE Support 3
J WAD Bad behavior in copy /S TCC/LE Support 5
J COPY /V (with Verify) and ERRORLEVEL TCC/LE Support 0
T copy /un vs. copy /nu TCC/LE Support 6
S copy ftp not working TCC/LE Support 5
Jesse Heines Request for TCC Date Command Custom Format Example TCC/LE Support 4
A vcvarsall.bat command not working on TCC LE command prompt TCC/LE Support 16
T Cursor-up for last command TCC/LE Support 4
B A command crash report TCC/LE Support 1
D The output of apm command is disordered. TCC/LE Support 1
M Bug in RENAME and KEYSTACK command? TCC/LE Support 9
C WAD Executing rename.py -y trigger internal rename command TCC/LE Support 5
G WAD Windows 10 - ver command TCC/LE Support 6
C Incompatibility with cmd.exe dir command TCC/LE Support 3
S Take Command 16.00.45 update crashed TCC/LE Support 2
A command typed? TCC/LE Support 12
O Redirection in for command does not work TCC/LE Support 7
CaptainFlint Command grouping differs from cmd? TCC/LE Support 22
S Fixed TCC-LE 13.05.65 x64 "option" command tabs broken TCC/LE Support 4
G unknown command (newbie post - be gentle) TCC/LE Support 3
Charles Dye ? command, TCC/LE vs. supported TCC/LE Support 3
O How to? Maintain command line history between reboots TCC/LE Support 8
C How to close Take Command? TCC/LE Support 2
Frank a question to "Take Command 13.04.52 Released" TCC/LE Support 3
J Help with Log Command TCC/LE Support 1
R How to? Add TCC Open command box here to context menu TCC/LE Support 2
jason404 Is there a command equivalent to ls -a in bash? TCC/LE Support 3
fpefpe time command -- time server TCC/LE Support 3
G What does this error means: TCC: Unknown command "C:\Program" TCC/LE Support 13
T trouble with start /runas command TCC/LE Support 1
R WAD TCC/LE does not set %_ffind_files TCC/LE Support 1
jbanaszczyk [Q] How to retrieve / set current TCC/LE language TCC/LE Support 1

Similar threads