This project has moved and is read-only. For the latest updates, please go here.

Command Line - Find with leading dash (-) throws error


Using fnr.exe from the command line, I found that searching with a leading dash (-) throws an error. For example --find "-E" fails with the error "--find required option is missing"


panny2406 wrote Jul 1, 2016 at 3:33 PM

This is also true for the value of the --replace parameter

adrianmanb wrote Mar 25 at 5:52 PM

I confirm this bug. Leading with a dash "-" throws an error from command line, although not the same between --find or --replace. Example:

fnr.exe --cl --dir "D:\animals" --fileMask "animals.txt" --find "rats" --replace "-bugs"

If the parameter leads with a dash but is a number, it does work, for instance:

fnr.exe --cl --dir "D:\animals" --fileMask "animals.txt" --find "rats" --replace "-123"

works fine.

WORKAROUND: --useEscapeChars and prefix the dash with a backslash, as in:

fnr.exe" --cl --dir "D:\animals" --fileMask "animals.txt" --useEscapeChars --find "rats" --replace "-bugs"
  • this does not help me when "-bugs" could be "nematods" and a "\nematods" will insert a new line.
WORKAROUND 2: my document doaes not contain ";", so I first replace prefixing with ";" then remove the ";"
--find "rats" --replace ";-bugs"
--find ";" --replace ""

Nashev wrote May 18 at 5:01 PM

I have similar trouble without minus sign in values:
Y:\!BuildAll>"Y:\!BuildAll\fnr.exe" --cl --dir "Y:\" --fileMask "*.dproj" --includeSubDirectories --useRegEx --skipBinaryFileDetection --alwaysUseEncoding "utf-8" --find "FileVersion=[\.\d]+;" --replace "FileVersion=;"
Find And Replace
Copyright (C) 2017 ENTech Solutions

  --find required option is missing.
  --fileMask required option is missing.

Use 'fnr.exe --cl --help' to see help for this command.

Nashev wrote May 18 at 5:10 PM

I've found I must escape \ before " in value of dir parameter