DOS script to start UltraEdit

DOS script to start UltraEdit

Rusty

    Jun 18, 2005#1

    I have a one-line DOS script called ed.bat that starts UltraEdit with whatever file name I enter. The script looks like this:

    start "c:\program files\ultraedit\uedit32" "%1"

    From the command prompt I type "ed filename.txt" and edits the filename.

    I used the "start" command so that it will give me back control of my DOS window instead of tying it up until I finish editing the file.

    That used to work great on my old computer, but now I have a new Windows XP computer and now it is acting up. Sometimes it starts a second DOS prompt and never edits the file. Sometimes it opens the file IN NOTEPAD!

    I can remove the word "start" and that does edit the correct file in UltraEdit, but it ties up my command prompt.

    I don't get it. What's the best way to get from a DOS command prompt to edit a file and not lose control of the DOS prompt?

    112
    Power UserPower User
    112

      Jun 18, 2005#2

      Type help start in the DOS box. Start behaves differently within a script.
      Check that none of the options have a bearing on your requirements.

      I'd specify the .exe extension. If you can avoid it, never give Microsoft any ambiguity... Remember they brought you "Intellisense" :wink:

      HTH,
      Paolo
      There is no such thing as an inconsistently correct system...
      Therefore, aim for consistency; in the expectation of reaching correctness!

      Rusty
      Rusty

        Jun 18, 2005#3

        Thanks for the response, but that didn't help.

        It looks to me like this has something to do with file associations. It works for some types of files but doesn't work for others. It's almost looks like Microsoft is trying to help me out by opening the files in the file type's default program before I can specify that I want to use UltraEdit.

        I've got to imagine that opening a file in UltraEdit from the command line is a pretty common thing. How do other people do that?

        112
        Power UserPower User
        112

          Jun 18, 2005#4

          Normally I do it in-line, so I don't have the problem of start. I only use UltraEdit from the command line when I want to execute a macro. Try adding a command to the end of the line like -f~!@! this may inhibit the file associations.

          Also I'd test it without the start and see if the problem is with the start command itself.

          HTH,
          Paolo
          There is no such thing as an inconsistently correct system...
          Therefore, aim for consistency; in the expectation of reaching correctness!

          12
          Basic UserBasic User
          12

            Jun 18, 2005#5

            Try start "c:\program files\ultraedit\uedit32.exe" "%1" and renaming the ed.bat to ed.cmd.
            You can also try start C:\PROGRA~1\ULTRAED~1\uedit32.exe "%1".
            And yes, the trailing % must be in there for a NT style command script...

            Rembember also that the default installation path of UltraEdit 11 is not in C:\Program Files\UltraEdit, but C:\Program Files\IDM\UltraEdit or something like that.

            The best option would be to associate txt files with UltraEdit or replace notepad with a "dummy" program to start UltraEdit.

            If this does not solve the problem, remember also sometimes not only the filename gets into %1. So if you use a long path in current prompt, windows just opens an empty UltraEdit and 'as a bonus' opens your file in the default editor for txt (notepad).
            So if you are in:

            Code: Select all

            C:\Documents and Settings\User\My Documents>
            Your batchfile will gets routed:

            Code: Select all

            start "c:\program files\ultraedit\uedit32.exe" c:\Documents and settings\User\My Documents\"file.txt"
            This is a Micro$oft product, so keep in mind Windows does not always works as expected.

            6,686585
            Grand MasterGrand Master
            6,686585

              Jun 18, 2005#6

              You have luck. I have had the same problem 3 weeks ago, as I have written an install batch file. The problem here is a bug of the start command from Microsoft on Win2k and WinXP (maybe also WinNT).

              If you enter start /?, you will get the little command help showing you also the optional title parameter. This parameter does not exist for "start" of Win9x. If your command line includes anywhere a pair of "", the title parameter is not optional anymore. You must specify a title, otherwise the first parameter inside "" is interpreted as title by the start command.

              There are some other problems with the start command of the various Windows versions. During my tests on Win95, Win98, Win2k and WinXP I found out, the best is to use the start command from Win95 on all Windows OSes. But this was not possible for the install batch file, because it was not designed for running only on my computers. It spent me 2 hours to find out, why the install batch files runs perfect on my Win98 and WinXP computer (with start command file from Win95, found first by the path environment variable) and fails on other Win2k and WinXP computers. At Win9x, the start command is a separate file, where on Win2k/XP it is integrated into cmd.exe. But this integrated start command is not used, when a start.com or start.exe is found in any directory specified by the path environment variable.

              Back to your problem! Use this command line in your batch file.

              start "UltraEdit" "c:\program files\ultraedit\uedit32.exe" "%1"
              Best regards from an UC/UE/UES for Windows user from Austria

              Rusty
              Rusty

                Jun 20, 2005#7

                Mofi,

                That fixed my problem! Thanks! I wouldn't have figured that out in a million years.

                Thanks to everybody else for their input too.

                Curses to Microsoft!
                :x