0 votes

Hi -- I am trying to launch FileLocator Pro via command line and using a regular expression to search inside all files for SSNs but I'm not having alot of luck. If I try:

FileLocatorPro.exe -d c: -s -o PIIScanResults_2015_11_4.csv -ofc -cex "^((?!000)(?!666)(?:[0-6]\d{2}|7[0-2][0-9]|73[0-3]|7[5-6][0-9]|77[0-2]))-((?!00)\d{2})-((?!0000)\d{4})$"

I get "Unexpected Command Line parameter" error message.

Separated by line, I have:

FileLocatorPro.exe  (program)
-d c:  (search c:\ drive)
-s   (search subdirs)
-o PIIScanResults_2015_11_4.csv   (output to this file)
-ofc   (format is *.csv) 
-cex "^((?!000)(?!666)(?:[0-6]\d{2}|7[0-2][0-9]|73[0-3]|7[5-6][0-9]|77[0-2]))-((?!00)\d{2})-((?!0000)\d{4})$"   (use this Regular Expression)

Removing the double-quotes gets me in trouble with DOS' command-line interpreter:

'7[0-2][0-9]' is not recognized as an internal or external command, operable program or batch file. I'm afraid under this scenario it's wanting me to provide Escape Codes (granted, the RegEx itself has Escape Codes in it as well, so I may end-up not doing a correct search if any additional Escape Codes are used).

Q: Is there a means to passively pass a regular expression? Or somehow get around this situation?

I looked at several Q/A's in the knowledgebase today & did not see anything similar that might give me a hint on what to try.

Thanks for any/all help & pointers!

asked by (30 points)

1 Answer

0 votes

The problem is that you've combined two parts of the command line parameters. If you want to specify content you use -c, e.g.

FileLocatorPro.exe -c "Search Text"

If you want to switch to regular expression you ADD -cex, e.g.

FileLocatorPro.exe -c "Search Text" -cex
answered by (67.5k points)
BINGO!!!  I didn't realize from reading the Command-Line Reference that I should declare the Regular Expression with the -c option as if it was regular text, and then add the -cex afterward.  

Once I tried that, it worked!

FileLocatorPro.exe -d c: -s -o PIIScanResults_2015_11_06.csv -ofc -c "^((?!000)(?!666)(?:[0-6]\d{2}|7[0-2][0-9]|73[0-3]|7[5-6][0-9]|77[0-2]))-((?!00)\d{2})-((?!0000)\d{4})$" -cex

Thanks much!!
...