TOUCH question

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
May 31, 2008
376
2
#1
Which of c a w times of a file can TOUCH change?
The help file, if I read correctly, says all three, but I can't get it to work.
I'm using an NTFS-formatted USB drive, I think that's a LFN drive, isn't it?
TCC 9.02.147 Windows XP [Version 5,1.2600]
Code:
C:\temp>del /q /e a & > a & for %i in (a c w) dir /M /K /H /T:%i a
28-09-2008  16:29               0  a
28-09-2008  16:25               0  a
28-09-2008  16:29               0  a

C:\temp>for %i in (a c w) touch /T%[i]17:01 a
28-09-2008 17:01:00,000  C:\temp\a
28-09-2008 17:01:00,000  C:\temp\a
28-09-2008 17:01:00,000  C:\temp\a

C:\temp>for %i in (a c w) dir /M /K /H /T:%i a
28-09-2008  16:29               0  a
28-09-2008  16:25               0  a
28-09-2008  17:01               0  a
According to TOUCH all of a c w times where changed - at least that's how I interpret the output, but according to DIR only w time was changed. What am I doing wrong?
 
#2
On Sun, 28 Sep 2008 16:42:04 -0500, "JP Software Forums"
<neil@jpsoft.com>,Stefano Piccardi <> wrote:


>for %i in (a c w) touch /T%17:01 a


It works here without [].

v:\> for %i in (a c w) dir /M /K /H /T:%i a
2008-09-28 17:01 0 a
2008-09-28 17:01 0 a
2008-09-28 17:01 0 a

v:\> for %i in (a c w) touch /T%i17:04 a
2008-09-28 17:04:00.000 V:\a
2008-09-28 17:04:00.000 V:\a
2008-09-28 17:04:00.000 V:\a

v:\> for %i in (a c w) dir /M /K /H /T:%i a
2008-09-28 17:04 0 a
2008-09-28 17:04 0 a
2008-09-28 17:04 0 a
 

rconn

Administrator
Staff member
May 14, 2008
10,101
85
#3
Stefano Piccardi wrote:

> Which of c a w times of a file can TOUCH change?
> The help file, if I read correctly, says all three, but I can't get it
> to work.
> I'm using an NTFS-formatted USB drive, I think that's a LFN drive, isn't it?
> TCC 9.02.147 Windows XP [Version 5,1.2600]
> Code:
>
> C:\temp>del /q /e a & > a & for %i in (a c w) dir /M /K /H /T:%i a
> 28-09-2008 16:29 0 a
> 28-09-2008 16:25 0 a
> 28-09-2008 16:29 0 a
>
> C:\temp>for %i in (a c w) touch /T%17:01 a
> 28-09-2008 17:01:00,000 C:\temp\a
> 28-09-2008 17:01:00,000 C:\temp\a
> 28-09-2008 17:01:00,000 C:\temp\a
>
> C:\temp>for %i in (a c w) dir /M /K /H /T:%i a
> 28-09-2008 16:29 0 a
> 28-09-2008 16:25 0 a
> 28-09-2008 17:01 0 a
>
> According to TOUCH all of a c w times where changed - at least that's
> how I interpret the output, but according to DIR only w time was
> changed. What am I doing wrong?


You cannot use the % construct for FOR variables. What you're doing
is appending an empty string to /T, so it's defaulting to 'w' each time.

Rex Conn
JP Software