Command Line Parameters
UltraEdit supports command line parameters specifying files to be opened. UltraEdit allows multiple files to be specified in the command line. Each of the files specified will be opened when UltraEdit starts up. The filenames on the command line should be separated with a space (' '). For long filenames, they should be enclosed in quotes "". All files specified for opening on the command line must be referenced using the full path to the file or only the file name and extension.
Additionally, UltraEdit supports two other methods of opening files on the command line:
Wildcard characters UltraEdit will accept any normal wildcard specification for files to be opened, i.e. "*.c" will open all files with the ".c" extension.
File containing list of files to be opened You may specify that the filename on the command line contains a list of files to open by using a "/f" parameter on the command line. In this case, UltraEdit will read each line of the files on the command line, and attempt to open each file. The file specified on the command line when the "/f" parameter is used must contain only filenames, and each filename must be on a separate line.
UltraEdit accepts a "/r" parameter on the command line to open files in a read-only manner.
When a file is deleted, by default UltraEdit will notify the user the file has been deleted. On occasions it may be desirable not to receive this notification. By adding "/n" to the command line the notification will be disabled for the files that are specified on the command line – this has no effect on files already opened, or files opened after this.
To specify the line and column number at which to position the cursor when the file is opened, the line number and column number should follow the filename immediately separated from the filename by a '/' character follows:
filename/5/2 This opens the file with the cursor positioned at line 5, column 2. The line number may be specified without specifying the column number.
The separator character '/' was a comma in previous releases, however as this is a valid character for filenames it has been changed. If it is preferred to use the comma or another character, the following line may be added to the INI file:
where the comma may be any character except a colon ':', however UltraEdit will not be able to open a file that contains this character.
Additionally, the command line may include –lx or –cx following the filename (space separated) where x is the line or column number and this can be after each file name. This is a new method and if used it should be after the file name separated with a space and if the filename is in quotes it should be after the quotes with a space between this and the quotes.
UltraEdit accepts a '/P' or '/p' on the command line. This instructs UltraEdit to print the files that appear on the command line automatically and to exit when the files have been printed.
UltraEdit accepts a '/O1' or '/O0' on the command line. This instructs UltraEdit to force the OEM Character Set to be used if '/O1' is specified, or force it not to be used if '/O0' is specified.
To specify whether a new or existing instance of UltraEdit should be used to open a specified file, the following flags may be used:
/foi is used to open a file in the original instance, e.g. uedit32 /foi "c:\temp\test.txt"
/fni is used to open a file in a new instance, e.g. uedit32 /fni "c:\temp\test.txt"
When forcing a new instance, users may also wish to specify a different environment than the one in use in the active instance. This may be done using the /see parameter as follows:
uedit32 /fni /see "Programmer" FilePath
Please note that the name of the environment to be used when opening the new instance must immediately follow the /see parameter.
UltraEdit permits the INI file used for UltraEdit settings to be specified by the user. If the command line contains "/I=filename" this is used.
The filename must follow the /i= immediately. It can be a long name with spaces, in which case it must be in quotes.
For more information on the INI settings see INI File Selection.
UltraEdit allows macros to be automatically invoked from the command line with the following syntax added to the command line:
/M,E,5="full path of macro file/macro name"
The /M specifies the macro command
The ,E specifies that after execution of the macro, the file should be saved and the editor exit, this is an optional parameter.
The ,5 specifies the number of times the macro should run. This is an optional parameter, and if not present the macro will run once if a file is loaded on the command line. If a file is not specified on the command line the macro will not run unless the number of times is specified.
The macro filename must be specified in quotes. Optionally, the name may include a forward slash (/) followed by the name of the macro if the file contains more than one macro. If a macro name is not specified, the first macro in the file will be used.
UltraEdit also allows scripts to be invoked from the command line with the following syntax added to the command line:
/s,e="full path to script file"
Example: /s,e="c:\working files\myscript.js"
The ,e specifies that after execution of the script, the editor should exit, this is an optional parameter. Please note: If it is desired that the modified file be saved, this should be handled within the executed script.
The file path/name must follow the /s= immediately. It can be a long name with spaces, in which case it must be in quotes.
There are occasions when starting UltraEdit from another application it may be necessary to invoke it with a filename that is already open to position at a specific line or column. In this case "/a" may be added to the command line and if present UltraEdit will NOT show the prompt that asks if the file should be reloaded and changes lost. Without this the user would be asked if the file should be reloaded and changes lost.
Finally, the command line may include "-f" to indicate that UltraEdit should perform a Find in the specified file. This MUST be the last parameter on the command line. For added flexibility this parameter will use the parameters specified for the last Find command executed from within UltraEdit, i.e. Match Case, Regular Expressions, etc. The format should be:
uedit32 c:\temp\test.txt -fdog
This would cause UltraEdit to open the file "test.txt" and search for the first occurrence of the string "dog" in the file.
|Posted - Thu, Oct 13, 2011 6:11 PM. This article has been viewed 19011 times.|
|Online URL: http://www.ultraedit.com/help/article/command-line-parameters-1228.html|
Powered by PHPKB Knowledge Base Software