![]() Use the for /r loop with the search mask to filter the desired files and execute the NirCmd setfiletime command for each file.Open a Command Prompt window and navigate to the directory containing the files you want to modify.Ensure that you have added the NirCmd folder’s path to your system’s PATH environment variable, as previously explained.To use the for /r loop with NirCmd to change file date and timestamp attributes, follow these steps: Modifying file date and timestamp attributes recursively with for /r Loop and NirCmd ![]() The %i variable represents the current file in the loop. %i: The command to execute for each file that matches the search mask.: Specifies the search mask, such as *.txt, to filter the files on which the command will be executed.If not provided, it defaults to the current directory. : Specifies the path to the folder where the search will be performed.The basic syntax of the for /r loop is as follows: for /r %i in () do %i Useful tip: How to Batch Rename Files in Windows 11 Basic Syntax of the for /r Loop While CMD does not have a built-in command to change file date and timestamp attributes, you can use the for /r loop with NirCmd to modify these attributes for multiple files. The for /r loop is a powerful construct in CMD that allows you to iterate through files and directories, including those within subdirectories. For example: nircmd setfiletime "example.txt" now now nowīatch change file date & timestamp using the “for /r” loop with NirCmd This is particularly useful if you want to update one or more of these attributes to the present moment without manually inputting the current date and time. When you use “now” as an argument, it will set the file’s creation, last modification, or last access date and time to the current date and time on your system. In addition to specifying a specific date and time, NirCmd also allows you to use the “ now” parameter. If you have issue modifying the date and time attributes of a file due to permission error, read: How to Take Ownership of a File, Folder or Drive in Windows 11. You must use the same date and time format: “ dd-mm-yyyy hh:mm:ss“. This command will change the creation, last modification and last access date and time (in that order) of example.txt to March 15, 2023, 10:22:30 AM. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |