Windows batch - where does this command write?

Viewed 25

I used this command in a windows command line:

C:\Users\myuser\Desktop>C:\Windows\System32\ForFiles.exe /P C:\myfolder\mysubfolder /S /M *.* /D +09/15/2022 /C "cmd /C echo @FSIZE >> sizes.txt"

I wanted to echo all the sizes for files in folder modified in the last 5 days.

I didn't found the output file.

I then solved the problem by changing the command to:

C:\Users\myuser\Desktop>C:\Windows\System32\ForFiles.exe /P C:\myfolder\mysubfolder /S /M *.* /D +09/15/2022 /C "cmd /C echo @FSIZE" > sizes.txt

Anyway, I'd like to know if I created a sizes.txt file somewhere on my hard drive.

Searched in the folder, subfolder, desktop, home folder, C:, C:\Windows, C:\Windows\System32... nothing...

1 Answers

I finally found them, yes "them".

One in each directory containing recently edited file(s).

Seems that the command forfiles executes is actually run where the file is located.

It's strange because if you specify cmd /C echo %CD% as command it actually prints the directory you run from, in my case Desktop!

Related