I'm trying to write a script that searches my network volume and returns a list of paths and files. I'd then like to use that list in a subprocess that runs a windows explorer search, allowing the user to drag and drop the files from the search browser to wherever. Where I'm getting hung up is passing the variable (list) into the subprocess string.
example:
foo = 'returned list'
subprocess.Popen(f'explorer /root,"search-ms:query={foo}"')
The string is part of a windows explorer search argument
search-ms:parameter=value[¶meter=value]&
is from MSDN Getting started with parameter-value arguments. https://msdn.microsoft.com/en-us/library/windows/desktop/ff684385(v=vs.85).aspx
If I run the subprocess string with a specific parameter, say genericFileName.fileExt, and the file(s) exists:
subprocess.Popen(f'explorer /root,"search-ms:query=genericFileName.fileExt"')
The subprocess launches explorer and displays the file(s)
When I try using a variable, the subprocess opens the explorer, but does not return a search result. I want to be able to use a variable within the subprocess string
So
"search-ms:query={foo}"
{foo} is the variable in the subprocess string
Any help is greatly appreciated.
Thank you again