Search code examples
command-lineportable-executable

Remove PE (Portable Executable) Command Line


How to remove some unused Command Line parameters from an executable? example: i have a EXE that using this following command line (-a, -b, -c, -1, -2, -3) how do i remove "-2" command? i've try to use RES Editor, HEX Editor and EXE Disassembler, but nothing. someone can help me? what the program must i use for this? because if i remove the "GetCommandLine(A/W)" function, it lost all commands. thanks.


Solution

  • You'd have to reverse engineer the executable, find where it checks for those arguments and remove the relevant code (e.g. by replacing it with NOPs).

    An easier option is to provide a wrapper executable that would sanitize the command line and call the original, unmodified, executable just with the options you want to preserve.