27 July, 2020

Command line 'search-ms'

I found this (below) command very handy, when I had to manually edit MP3 metatags, on about 18 files, all in different folders.

For some reason, a bunch of the files in my iPod back-up (that I then stream thru PLEX), had some messed up metatags, that I think, trow off the entire PLEX music database (still trying to figure THAT bit out)...

So in a separate process (script), I audited the 'Artist' and 'Title' tags - and where missing, I collected the details about those files into ($NullQuery) a 'psobject',  so I could parse thru it, and fix each file...

$NullQuery | % {
$_File = $_.File
$_Folder = Split-Path $_.FilePath
explorer.exe "search-ms:query=$_File&crumb=location:$_Folder&"

It took a bit of digging to discover how to bring up an individual file in an explorer window, similar to what happens when you use the 'search' option in Windows File Explorer...

Here is THAT command: 

explorer.exe "search-ms:query=$_File&crumb=location:$_Folder&"

Where "$_File" is the name of the file 'BLAH.mp3', and "$_Folder" is the folder that file is in.
(You may not need anything after "$_File", but I suspect that including the folder, really speeds up the search)

No comments:

Post a Comment