Home » Support » Tutorials/Power Tips » UltraEdit » Run a macro or script from the command line
IDM Power Tips

Run a macro or script from the command line

We are often asked if it is possible to run an UltraEdit macro or script on a file from the command line. The answer is yes - and it's not only possible, it's extremely simple!

Running a script or macro on a file from the command line saves you the time of actually opening the application, opening the file, then opening and running the macro or script. We will take a look at how this is done below.

Run a Macro or Script from the Command Line

Run a Macro or Script from the Command Line

UltraEdit can be invoked from the command line in Windows. This is most often done using the Dos-prompt box which usually is accessed under Start -> Programs -> Accessories. The command line gives you more power and control over your standard Windows operations and provides the flexibility required for tasks that may exceed the user-friendliness of the Windows user interface.

To invoke UltraEdit from the command line, simply enter "uedit32" and press Enter. This will open UltraEdit, just as clicking on the UltraEdit icon in Windows will.

To invoke UltraEdit to open a specific file, you would type "uedit32" followed by the path of the file you'd like to open. You can also open multiple files by separating them with a space. Here is an example:

uedit32 c:\temp\test.txt c:\temp\index.html c:\temp\index.php c:\temp\stat.js

Note: For long file names, it may be necessary to enclose the file path and name in quotes.

To invoke UltraEdit from the command line and play a macro or script on a certain file(s), you would need to add the parameter "/m" for macros or "/s" for scripts, followed by an equal sign and the path to the macro. So, to play a macro on a certain file from the command line you would use the following:

uedit32 c:\temp\test.txt /m="c:\temp\macro.mac"

To play a script, you would use the following:

uedit32 c:\temp\test.txt /s="c:\temp\script.js"

Additionally, you can specify via the command line how many times the macro/script is played, and whether to close UltraEdit after the macro/script is played. So the following command line entry:

uedit32 c:\temp\test.txt /m,e,2="c:\temp\macro.mac"

Tells UltraEdit to play the macro twice (specified by the "2") and then to exit UltraEdit (specified by the "e").

Run a Macro or Script from the Command Line

For scripts, your command line would look similar to the following:

uedit32 c:\temp\test.txt /s,e="c:\temp\script.js"

Run a Macro or Script from the Command Line

Further Command Line Parameters

You can do much more with the command line than just playing scripts and macros. Here are the other available command line parameters for UltraEdit:

Command Line Format Result
uedit32 *.html Will open all .html files in current directory in UltraEdit
uedit32 /f c:\temp\list.txt Will open all listed files in c:\temp\list.txt in UltraEdit.  One file must be listed per line in the specified list file.
uedit32 /r c:\temp\test.txt Will open c:\temp\test.txt as READ-ONLY.
uedit32 c:\temp\test.txt/10/15 Will open c:\temp\test.txt and place the cursor at line 10, column 15.  The line number may be specified without specifying the column number.
uedit32 c:\temp\test.txt /p Will open c:\temp\test.txt and print it, then immediately close UltraEdit
uedit32 c:\temp\test.txt /fni Will open c:\temp\test.txt in a new instance of UltraEdit
uedit32 c:\temp\test.txt /foi Will open c:\temp\test.txt in the original instance of UltraEdit (UltraEdit must currently be opened).
uedit32 c:\temp\test.txt /i=c:\temp\uedit32.ini Allows you to open UltraEdit with a differen INI file; will open c:\temp\test.txt in UltraEdit using the INI file in c:\temp\.
uedit32 c:\temp\test.txt -fdog Will open c:\temp\test.txt and search for the first occurrence of "dog" in the file.  UltraEdit will use your last-used settings for your last Find for this find.  This MUST be the last parameter on the command line.


Back to power tips index

Career opportunities

Now hiring
Positions available at IDM

Cnet/Download.com
"We won't mince words:
UltraEdit is outstanding..."

Corporate Licensing

It's easy to purchase corporate licensing from us!

  • Bulk/quantity discounts
  • Enterprise/plant/site licensing
  • Purchase with PO or invoice

The new UltraSuite

The only fully integrated solution of its kind!

Four powerful applications: UltraEdit, UltraCompare, UltraFinder, and UltraSentry!

Save over 33% when you bundle with the UltraSuite!

Power of Portable

Now supporting PortableApps!

UE/UC Mobile

Unleash the power of the total file management solution on your flash drive!