Search and replace from the command line
FileMonkey cannot directly perform search and replace from the command line. For this reason, we have created a separate search and replace utility that we distribute with FileMonkey free of charge.
Although called from the command line, this utility can only be run under a Windows operating system.
The utility is called DOSSR.exe and you can find it in the folder that you have installed FileMonkey in (usually something like: C:\Program Files\FileMonk\DOSSR.exe)
When placed on the command path, the utility can be called like so:
DOSSR "full path of file" "search phrase" "replace phrase"
DOSSR "c:\my documents\my text file.txt" "hello" "goodbye"
You may also explicitly call the module like so:
c:\progra~1\filemonk\dossr.exe "hello" "goodbye"
or like so:
start/w c:\progra~1\filemonk\dossr.exe "hello" "goodbye"
The module sets the errorlevel variable to 0 on success and 1 on failure.
- The module should not be used on files larger than 1 MB
- Parameters cannot contain quote marks (except encompassing)
- There is no support for wildcards
- There are no case sensitive options
FileMonkey comes equipped with a much more powerful search and replace engine however, DOSSR has the advantage of being called from DOS, something that FileMonkey does not support.
Where possible, it is best to use the in-built FileMonkey search and replace feature.