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

Using DOSKEY Macro in Batch File

Expand Messages
  • Gagneet
    Hi, My problem is that I have to use a DOSKEY macro created within a batch file in another batch file which is calling the first. So suppose I have the
    Message 1 of 3 , Aug 8, 2006
      Hi,

      My problem is that I have to use a DOSKEY macro created within a batch
      file in another batch file which is calling the first.

      So suppose I have the following macro defined in MacroBatch.bat
      @ECHO OFF
      REM
      #########################################################################
      REM # Environment for My Applications Controller. This file has bash
      syntax.
      REM #
      REM
      #########################################################################
      SET MYAPPS=yes
      SET BASE_DIR=%CD%\..
      doskey myMacro=%GMAKE_CMD% -I %BASE_DIR%\productA\mk build_info=1
      build_lang=1 build_ha=0 build_quick=1 build_web=1 $*

      Now, I have another batch file which is using the following:
      MacroBatch winxp chk
      myMacro all

      When I run the second batch file, I am unable to run the second
      command in it, I get the error message:
      'myMacro' is not recognized as an internal or external command,
      operable program or batch file.

      I know that DOSKEY macros will not be accessible from within Batch
      files, but there has to be a way to make this work. I cannot make
      changes to the first file to take out the macro as it is a part of a
      framework which other people execute to cater for their own applications.

      Is there some way that I can make/run that 'myMacro' from within my
      batch file?

      Thanx,

      Gags
    • Parag P. Doke
      Try saving the macro in an external file (say macros.txt). Load it in batch file1 using: doskey /macrofile=%~dp0macros.txt Then call batch file1 in file 2 and
      Message 2 of 3 , Aug 8, 2006
        Try saving the macro in an external file (say macros.txt). Load it in
        batch file1 using:
        doskey /macrofile=%~dp0macros.txt
        Then call batch file1 in file 2 and use the macro.

        I tried this on Windows 2000 Prof.
        -Parag

        On 8/8/06, Gagneet <gasingh@...> wrote:
        > Hi,
        >
        > My problem is that I have to use a DOSKEY macro created within a batch
        > file in another batch file which is calling the first.
        >
        > So suppose I have the following macro defined in MacroBatch.bat
        > @ECHO OFF
        > REM
        > #########################################################################
        > REM # Environment for My Applications Controller. This file has bash
        > syntax.
        > REM #
        > REM
        > #########################################################################
        > SET MYAPPS=yes
        > SET BASE_DIR=%CD%\..
        > doskey myMacro=%GMAKE_CMD% -I %BASE_DIR%\productA\mk build_info=1
        > build_lang=1 build_ha=0 build_quick=1 build_web=1 $*
        >
        > Now, I have another batch file which is using the following:
        > MacroBatch winxp chk
        > myMacro all
        >
        > When I run the second batch file, I am unable to run the second
        > command in it, I get the error message:
        > 'myMacro' is not recognized as an internal or external command,
        > operable program or batch file.
        >
        > I know that DOSKEY macros will not be accessible from within Batch
        > files, but there has to be a way to make this work. I cannot make
        > changes to the first file to take out the macro as it is a part of a
        > framework which other people execute to cater for their own applications.
        >
        > Is there some way that I can make/run that 'myMacro' from within my
        > batch file?
        >
        > Thanx,
        >
        > Gags
        >
        >
        >
        >
        >
        >
        >
        > To Post a message, send it to: batchworld@...
        >
        > To Unsubscribe, send a blank message to: batchworld-unsubscribe@...
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >


        --
        Parag P. Doke
        http://paragpdoke.blogspot.com
      • Gagneet
        Thanx a lot Parag, but my problem is that, I am unable to use that macro out of the first batch file. And for this solution I shall have to take that macro out
        Message 3 of 3 , Aug 9, 2006
          Thanx a lot Parag, but my problem is that, I am unable to use that
          macro out of the first batch file. And for this solution I shall have
          to take that macro out and use it from a separate file, which
          currently is not going to be the case, as I am not allowed to use
          anything else except that file.

          So, I want a method to export that macro to the outside world, so as
          to let the command line make use of it from within a batch file... :-(

          Well! Anyways, thanx a lot, I shall try a workaround for this.

          - Gags

          --- In batchworld@yahoogroups.com, "Parag P. Doke" <paragpdoke@...> wrote:
          >
          > Try saving the macro in an external file (say macros.txt). Load it in
          > batch file1 using:
          > doskey /macrofile=%~dp0macros.txt
          > Then call batch file1 in file 2 and use the macro.
          >
          > I tried this on Windows 2000 Prof.
          > -Parag
          >
          > On 8/8/06, Gagneet <gasingh@...> wrote:
          > > Hi,
          > >
          > > My problem is that I have to use a DOSKEY macro created within a batch
          > > file in another batch file which is calling the first.
          > >
          > > So suppose I have the following macro defined in MacroBatch.bat
          > > @ECHO OFF
          > > REM
          > >
          #########################################################################
          > > REM # Environment for My Applications Controller. This file has bash
          > > syntax.
          > > REM #
          > > REM
          > >
          #########################################################################
          > > SET MYAPPS=yes
          > > SET BASE_DIR=%CD%\..
          > > doskey myMacro=%GMAKE_CMD% -I %BASE_DIR%\productA\mk build_info=1
          > > build_lang=1 build_ha=0 build_quick=1 build_web=1 $*
          > >
          > > Now, I have another batch file which is using the following:
          > > MacroBatch winxp chk
          > > myMacro all
          > >
          > > When I run the second batch file, I am unable to run the second
          > > command in it, I get the error message:
          > > 'myMacro' is not recognized as an internal or external command,
          > > operable program or batch file.
          > >
          > > I know that DOSKEY macros will not be accessible from within Batch
          > > files, but there has to be a way to make this work. I cannot make
          > > changes to the first file to take out the macro as it is a part of a
          > > framework which other people execute to cater for their own
          applications.
          > >
          > > Is there some way that I can make/run that 'myMacro' from within my
          > > batch file?
          > >
          > > Thanx,
          > >
          > > Gags
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > > To Post a message, send it to: batchworld@...
          > >
          > > To Unsubscribe, send a blank message to: batchworld-unsubscribe@...
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          >
          >
          > --
          > Parag P. Doke
          > http://paragpdoke.blogspot.com
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.