A set of files to load can be specified on the command line when starting 010 Editor. Each file to load should be separated by a space. For example, to load two files use:
010editor file1.dat file2.dat
Multiple files can be loaded on the command line by using the wildcards '*' and '?'. For example:
010editor *.bin file???.dat
By default, when 010 Editor is installed it is placed in the system path. This means that 010 Editor can be run from any command line by entering '010editor' (no directory needs to be specified).
This command line syntax can be used to load files even if 010 Editor is already running.
To not place 010 Editor in the path, disable the 'Add 010 Editor to the system path' toggle in the install program.
Drives can be opened from the command line by using the -drive: command, followed by either a drive label or a drive number. If a drive label is specified, a logical drive is opened and if a drive number is specified, a physical drive is specified (see Editing Drives for more information). For example:
010editor -drive:C -drive:1
would open logical drive C: and physical drive 1.
Processes can be opened using the -process: command, followed by either a process identification number or a name of a process. For more information on working with processes, see the Editing Processes help topic. For example, to open two processes from the command line use:
010editor -process:cmd.exe -process:1074
To import any of the available file formats, use the -import: command, followed by the file to load. Any of the accepted import or export types are accepted and the type used will be based from the file extension (see Importing/Exporting Files for more information). For example, to import a C file use:
The wildcard characters '*' and '?' can also be used to import multiple files at the same time.
Position the Cursor and Selections
The cursor can automatically be positioned when a file, drive, or process is loaded, or when a file is imported using -import. Append the character '@' followed by a numeric address to the file name. Note that any of the standard numeric formats are accepted. For example, to load a file and position the cursor at address 256 use:
Additionally, a selection can be made when opening a file by appending a second '@' and size after the position above. For example, to open a file and drive C with the cursor at position 16 and the next 4 bytes selected use:
010editor file1.dat@16@4 -drive:C@16@4
Opening Scripts or Templates
Scripts or Templates can be run from the command line using the -script: or -template: command respectively. See Introduction to Templates and Scripts for more information on Templates and Scripts. To run the script IsASCII for example, use:
The file to run must exist in either the current directory, the current 'Scripts' directory if running a script, or the current 'Templates' directory if running a template (these directories can be modified in the Compiling Options). To open the Script or Template in the interface without running the file, specify a '@' symbol and a line number after the filename. For example, to open the ZIPTemplate.bt file and position the cursor on the 3rd line, use:
Command line arguments can be passed to a script or template by using the syntax
:(<arg1>,<arg2>,...,<argN>) after the script or template command. For
would pass the two arguments "15" and "Test" to the MyScript.1sc script. To include spaces in any of the arguments,
place double quotes around the whole command. The arguments can be retrieved in the
script or template using the GetNumArgs, GetArg
and GetArgW functions.
Saving and Closing Files
The current open file can be saved to disk by using the -save command. To save a file to a different file name, use the command -save:<filename>. For example:
010editor temp.txt -save:temp.txt.bak
To save all modified files use the -saveall command or to close the current file, use the -close command.
Replacing Strings or Bytes
A string or a set of bytes can be replaced from the command line using the -replace:<find_value>:<replace_value> command. For example:
010editor temp.txt -replace:apple:orange
would replace all occurrences of apple with orange in the file temp.txt. Note that if there are spaces in any of the replace strings, surround the whole -replace command with double quotes. The replacement options can be controlled, and special characters can be inserted into strings through the use of escape codes which start with the character '\'. The following special escape codes can be used:
\m = match case|
\w = match whole word
\p = pad with zeros
\a = perform replacement on all open files
\* = search with wildcards
\\ = insert a '\' character
\: = insert a colon
\' = insert double quotes "
For example, to replace the string 'first' with 'second' using the match case and whole word options, use:
Different data types can be indicated using a comma and type specifier after the value
(e.g. ',h' indicates hexidecimal bytes). For example, use
to replace Windows linefeeds with
Unix linefeeds. See the Find dialog for a list of type
Two files can be compared from the command line using the -compare:<fileA>::<fileB> or the
-compare:<fileA>::<fileB>::<options> command. For example:
would run a regular binary comparison on the two given files. Notice the double-colon '::' between the file names and if there are spaces in either file name, surround the whole -compare command with double quotes. To specify options for the comparison, use another double-colon '::' after the second file name and specify one or more of the following special escape codes (note that 'XXX' indicates a number):
\b = byte by byte comparison|
\i = ignore case
\e = enable synchronized scrolling
\xXXX = max look-a-head
\nXXX = min match length
\qXXX = quick match length
\saXXX = limit start for file A
\sbXXX = limit start for file B
\zaXXX = limit size for file A
\zbXXX = limit size for file B
For example, to compare two files and ignore the case, use:
or to limit the comparison to the first 16 bytes of each file, use:
See Comparing Files for an explanation of the different options for comparisons. Note that if a Max Look-a-head, Min Match Length, or Quick Match is not specified
the values from the last time the Compare dialog was run will be used. Running '010editor -compare:' will give a list of all comparison options.
Running 010 Editor in Batch Files
If running 010 Editor from a batch file, it is possible to pass error level codes from a script or template back to the batch file. First, in a script or template call the function Exit with an error code (e.g. 'Exit(-5);'). Next, in a batch file start 010 Editor by using the syntax 'start /wait 010editor ...'. Afterwards the error code can be accessed in the batch file using the variable %ERRORLEVEL%. For example:
start /wait 010editor test.txt -template:test.bt -exit
Running 010 Editor without a User Interface
When running 010 Editor from the command line, the software can be executed without
a user interface by specifying the -noui command. In this mode, the splash screen
and main window of 010 Editor are not displayed and the program will exit automatically
when all the command line options are executed. Note that in this mode, messages boxes
may still be displayed on error messages and this may stop program execution until the
message box is cleared by the user. To disable the display of any message boxes,
include the -nowarnings option on the command line. The -noui command
line option is very useful when running 010 Editor from a batch file (see above).
Resetting the Application
Options for 010 Editor can be reset by using the command line. Specify the -reset command on startup to reset just the docking panel positions. Specify -resetall to revert all application settings to their defaults. If 010 Editor will not startup, specifying -reset or -resetall will usually fix the problem.
Exiting the Application
Use the -exit command to shut down 010 Editor from the command line (all unsaved modifications will be lost).
Alternately the -exitnoerrors command can be used to shut down 010 Editor only if
no errors occurred. Here an error is defined to be a Script or Template that did not compile
or execute properly, or a Script or Template that was halted using the Exit
function with a negative error code.
Other Command Line Parameters
The -readonly command can be used to set the last opened file, drive, or process to Read Only. The -h command will display this manual page.