Loading ...
Sorry, an error occurred while loading the content.
 

Re: DOS batch question

Expand Messages
  • John Zeman
    %1 represents the first argument you send to a batch file or even to another program. So what %1 actually is, depends upon what you are doing. For example,
    Message 1 of 7 , Mar 25, 2008
      %1 represents the first argument you send to a batch file or even to
      another program.

      So what %1 actually is, depends upon what you are doing.

      For example, suppose you create a batch file named runme.bat and the
      contents of that batch file are:


      echo Hello, %1 %3
      pause


      From a Command prompt in the directory where runme.bat resides type:

      Runme Johnny Susan Joy

      And the result you should see would be: "Hello, Johnny Joy"


      John




      --- In ntb-OffTopic@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
      >
      > I need to write a batch that receives a full path as %1
      >
      > Question one: Can I change that in W98 regedit? It currently has
      > mypath/mybat.bat "%1"
      > in it. Could I send path and file as different parameters?
      >
      > Assuming the answer to question 1 is no, can I do it inside the batch?
      > I first need to issue a chdir %1, which won't work of course, without
      > dropping the file.
      > I then need to use the filename without extension in further commands.
      > Are there any batch commands or utilities to do that? It's easy in
      > pascal, but I don't wont to go that length.
      >
      > Danke
      > Axel
      >
    • Axel Berger
      ... Yes, that s just my problem. What I shall be doing is double-click something in a window, in this case it may be a browser window or a directory. So my
      Message 2 of 7 , Mar 25, 2008
        John Zeman wrote:
        > So what %1 actually is, depends upon what you are doing.

        Yes, that's just my problem. What I shall be doing is double-click
        something in a window, in this case it may be a browser window or a
        directory. So my "%1" is out of my control and will always be a full
        path. I need to somehow split it myself.

        Axel
      • John Zeman
        If you were running Windows 2000 or newer, it would be no problem at all to extract different parts of %1. However I don t think Windows 98 is capable of it
        Message 3 of 7 , Mar 25, 2008
          If you were running Windows 2000 or newer, it would be no problem at
          all to extract different parts of %1. However I don't think Windows
          98 is capable of it although it's been so long since I've used that, I
          can't say so for sure.

          You could give it a try. Send a fully qualified file name to a batch
          file, and see what happens when you insert these lines at the
          beginning of the batch file:

          echo %~n1
          echo %~p1
          echo %~f1

          I'm working from memory here but in more current versions of Windows
          those lines should echo the file name first, then the path of %1, and
          the last line should be the entire name and path.

          John





          --- In ntb-OffTopic@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
          >
          > John Zeman wrote:
          > > So what %1 actually is, depends upon what you are doing.
          >
          > Yes, that's just my problem. What I shall be doing is double-click
          > something in a window, in this case it may be a browser window or a
          > directory. So my "%1" is out of my control and will always be a full
          > path. I need to somehow split it myself.
          >
          > Axel
          >
        • Axel Berger
          ... Unfortunately you seem to be right about that. Danke Axel
          Message 4 of 7 , Mar 25, 2008
            John Zeman wrote:
            > However I don't think Windows 98 is capable of it

            Unfortunately you seem to be right about that.

            Danke
            Axel
          • John Zeman
            Axel you might want to take a look at 4DOS. It s for older versions of Windows like 98, and you can t beat its now free price. 4DOS was the precursor to 4NT,
            Message 5 of 7 , Mar 25, 2008
              Axel you might want to take a look at 4DOS. It's for older versions
              of Windows like 98, and you can't beat its now free price. 4DOS was
              the precursor to 4NT, which is what I use to write command line
              scripts. I think 4DOS can do what you want.

              If you're interested, here's a couple links. The first is the
              download page for the 4DOS program.

              http://www.jpsoft.com/download.htm

              http://www.4dos.info/v4dos.htm

              John



              --- In ntb-OffTopic@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
              >
              > John Zeman wrote:
              > > However I don't think Windows 98 is capable of it
              >
              > Unfortunately you seem to be right about that.
              >
              > Danke
              > Axel
              >
            • Axel Berger
              ... I have frequently done so and always meant to get it. Up to now the price always was just a bit above my I don t need it right now mark. (Don t remember
              Message 6 of 7 , Mar 25, 2008
                John Zeman wrote:
                > Axel you might want to take a look at 4DOS.

                I have frequently done so and always meant to get it. Up to now the
                price always was just a bit above my "I don't need it right now" mark.
                (Don't remember exactly, but must have been a lot more than NoteTab.) It
                having become freeware is great news.
                Thanks Don

                Axel

                P.S: And of course it did solve the problem with ease.
              Your message has been successfully submitted and would be delivered to recipients shortly.