Welcome to the Mythicsoft Q&A site for:

- Agent Ransack
- FileLocator Lite
- FileLocator Pro

Please feel free to ask any questions on these products or even answer other community member questions.

Useful Links:

- Contact Us
- Help Manuals
- Mythicsoft Home
0 votes

How do you perform an indexed search from the commandline (or powershell script) where the search string contains a space.

for instance

PS C:\Users\user> & "C:\Program Files\MythicSoft\FileLocator Pro\filelocatorpro.exe"
-c "\""Hello World\""" -idxname "idxname" -o "C:\tmp\out.txt"

returns unexpected command line parameter World"

Any suggestions?

by (30 points)

1 Answer

0 votes

PowerShell's quoting rules are a bit odd but I was successful in using a single quote for the parameter and double-quotes for any embedded quotes:

-c '""Hello World""'

A good way to test your command line parameters is to leave out the -o option and just see how FileLocator Pro pre-populates the fields in the GUI.

by (83.5k points)
Thanks Dave,
You do need the double double quote, as I'm using it in PowerShell script

Guess I figured it out using Start-Process
In script:

   $search = "Hello World"
   $indexName= "myIndex"
   $args = "-c ""\""$($search)\"""" -idxname $($idxName)"
   Start-Process -FilePath 'C:\Program Files\Mythicsoft\FileLocator Pro\FileLocatorPro.exe' -ArgumentList $args
Apologies, answer corrected. My previous answer was written in haste and not properly tested. Looks like quoting rules are a constant annoyance and also changing between the versions.
...