0

Without using PowerShell or other scripts, and only using built-in Windows command-line programs, I'm trying to find files modified after a certain date and time, but I'm having trouble. This is the command I'm using:

wmic datafile where "drive='c:' and path='\path\to\folder\' a nd lastmodified>'201905141200'" get name

I've also tried various combinations without quotes around the lastmodified value, however, I keep getting:

ERROR:

Description = Invalid query

Is it not possible to query the 'lastmodified' field with WMIC? Again, I'm trying to do this outside of PowerShell and without scripts -- purely command-line syntax.

7
  • If you're doing it without scripts why are you doing it on the commandline? Why would you not use e.g. the search within the explorer? Commented May 15, 2019 at 11:45
  • Because I'm accessing the box via ssh. Commented May 15, 2019 at 11:50
  • 1
    Which SSH implementation is the host using? Windows doesn't come with SSH out of the box. Commented May 15, 2019 at 11:56
  • Also why is PowerShell not an option? It is a built-in Windows command-line. Commented May 15, 2019 at 11:57
  • @Burgi I didn't set up the box, one of my admins did. Based on the path of the process, I'd say he installed OpenSSH-Win64. Commented May 15, 2019 at 12:02

1 Answer 1

0

I figured it out... the lastmodified value being queried has to be in this format:

YYYYMMDDHHmmSS.NNNNNN-###

YYYY = Year
MM = Month
DD = Day
HH = Hour
mm = Minute
SS = Second
NN = Nanosecond
### = 3 digit number (I guess '000' would be fine?)

Therefore, the correct command would be something like:

wmic datafile where "drive='c:' and path='\\path\\to\\folder\\' a nd lastmodified>'20190515074900.000000-000'" get name

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.