Link to home
Start Free TrialLog in
Avatar of jack niekerk
jack niekerkFlag for Netherlands

asked on

change date of files in command line windows 10 64 bit

looking for replacement the old 32 bit TOUCH program to change by commandline the date for file   like it was in dos
its not running in 64 bit

touch j:\*,*   or touch j:\*.txt    will files selected to today date
Avatar of oBdA
oBdA

How about a quick PowertShell script, disguised as batch for easier handling?
Save as touchPS.cmd or Whatever.cmd, run as
touchPS J:\*.txt
@PowerShell.exe -Command "$t = Get-Date; Get-ChildItem -Path '%~1' -File | ForEach-Object {$_.FullName + ' [' + $_.LastWriteTime + ' --> ' + $t + ']'; $_.LastWriteTime = $t}"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you really want a version of the touch utility for Windows that runs on 64 bit you can grab it out of the GIT portable distribution on this page.  See the "64-bit Git for Windows Portable." link.  I have GIT installed and find it useful to have a number of the unix utils available from its installation, but you don't have to install it to use some of the utils.  Just extract the files to a folder and then poke around in the bin subfolders (like usr/bin) and grab the touch.exe program.


>C:\_pf\Git\usr\bin\touch.exe --version
touch (GNU coreutils) 8.31
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, Arnold Robbins, Jim Kingdon,
David MacKenzie, and Randy Smith.


>C:\_pf\Git\usr\bin\touch.exe --help
Usage: /usr/bin/touch [OPTION]... FILE...
Update the access and modification times of each FILE to the current time.

A FILE argument that does not exist is created empty, unless -c or -h
is supplied.

A FILE argument string of - is handled specially and causes touch to
change the times of the file associated with standard output.

Mandatory arguments to long options are mandatory for short options too.
  -a                     change only the access time
  -c, --no-create        do not create any files
  -d, --date=STRING      parse STRING and use it instead of current time
  -f                     (ignored)
  -h, --no-dereference   affect each symbolic link instead of any referenced
                         file (useful only on systems that can change the
                         timestamps of a symlink)
  -m                     change only the modification time
  -r, --reference=FILE   use this file's times instead of current time
  -t STAMP               use [[CC]YY]MMDDhhmm[.ss] instead of current time
      --time=WORD        change the specified time:
                           WORD is access, atime, or use: equivalent to -a
                           WORD is modify or mtime: equivalent to -m
      --help     display this help and exit
      --version  output version information and exit

Note that the -d and -t options accept different time-date formats.

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
Full documentation <https://www.gnu.org/software/coreutils/touch>
or available locally via: info '(coreutils) touch invocation'

Open in new window


»bp
Avatar of jack niekerk

ASKER

thanks all for help
SOLVED MY OLD DOS ISSUE