Find The Last Modified Files On Your System

Have you ever click on a save button and don’t know where your files are? Do you want to know what files have been changed by the last running program? Here you will find an easy way to know what the last modified files of your system are.

Powershell is the new scripting language for Windows systems. To use this new feature in Windows 7 you don’t need to install anything. We are going to create a Script using Powershell that is going to show those modified files.

Windows 7 is very restrictive with the use of Powershell, so we are going to need to insert the script in a bat file to execute it.

The script

Here is the code:

@echo off

Powershell -noexit "Get-PSdrive  | where { $_.Used -gt 0 } | foreach { Get-ChildItem $_.Root -recurse -ErrorAction SilentlyContinue | Where {!$_.PsIsContainer} | Where {$_.DirectoryName -notlike 'c:\windows*' } | Select Name,DirectoryName, LastWriteTime, Mode | Sort LastWriteTime -descending | select -first 20}  | Out-GridView"

The script only displays 20 results, if you want more or less just change the number after select -first.

Open a new notepad. For this use WinKey + R, type notepad and press Enter.Once notepad is open copy the script and you will get something like this:

Save it using the file menu, but don’t forget to use the quotation marks, so notepad will create a bat file.

Click on the save button and a new file will appear.

The test

Open a Wordpad or whatever program you want and write something:

Save it to have a new file. Execute the script and see the result. Be patient the script has to process every file on your system.

The script only shows the last 30 modified files. In order to obtain better information the hidden files are not displayed. The script doesn’t show if a file has changed in the Windows directory. You have to understand that Windows 7 is doing a lot of work without your notice and this solution try to focus in what the user or the programs has done.

I hope you have enjoyed the reading and find the script useful. So why not letting me know new ideas for a script?

2 comments… add one

  • Ashok Kumar

    will this script work in xp???

    • You can install Powershell in Windows Xp is a free download from Microsoft.

Leave a Comment