Add %CD% to PATH in command.com - note that cmd.exe fix does not work












0















Goal: Issue a simple command to add the current directory to the PATH statement. Rather than type in every agonizing stroke, I would rather call a batch file, say xpath (where xpath.bat sits in an active path).
Doesn't work: path=%path%;%cd% does not work under command.com, neither in batch nor on the command line, although it works perfectly in later cmd.exe systems.
Confusing: Several other system variables or strings can be manipulated this way.



%CD% (or CD) is behaving differently.



Environment: I am using FreeDOS 1.2 under Virtualbox 5.2.22

This failure is consistent under MS-DOS 6.22 also under Vbx 5.2.22





C:SSH>path  
PATH=C:FDOSBIN
C:SSH>set newdir=C:SSHCONTRIB
C:SSH>echo %newdir%
C:SSHCONTRIB // success
C:SSH>path=%path%;%newdir%
C:SSH>path
PATH=C:FDOSBIN;C:SSHCONTRIB // success


*** But



C:SSH>path 
PATH=C:FDOSBIN
C:SSH>set newdir=%cd%
C:SSH>echo %newdir%
ECHO is on // unexpected
C:SSH>path=%path%;%newdir%
C:SSH>path
PATH=C:FDOSBIN;C:SSHCONTRIB //unchanged




The "echo is on" as well as other failures are consistent with %cd% resolving to nothing.

So CD, like PATH, appears to be a COMMAND whose output can be captured by evaluating it as a %VARIABLE%, but this is probably only the desired appearance. Sounds like the two are fundamentally different, and CD does not work consistently under COMMAND.COM.

NOTE that there is another question floating around out there with a solution that works nicely under cmd.exe. This is not that.










share|improve this question





























    0















    Goal: Issue a simple command to add the current directory to the PATH statement. Rather than type in every agonizing stroke, I would rather call a batch file, say xpath (where xpath.bat sits in an active path).
    Doesn't work: path=%path%;%cd% does not work under command.com, neither in batch nor on the command line, although it works perfectly in later cmd.exe systems.
    Confusing: Several other system variables or strings can be manipulated this way.



    %CD% (or CD) is behaving differently.



    Environment: I am using FreeDOS 1.2 under Virtualbox 5.2.22

    This failure is consistent under MS-DOS 6.22 also under Vbx 5.2.22





    C:SSH>path  
    PATH=C:FDOSBIN
    C:SSH>set newdir=C:SSHCONTRIB
    C:SSH>echo %newdir%
    C:SSHCONTRIB // success
    C:SSH>path=%path%;%newdir%
    C:SSH>path
    PATH=C:FDOSBIN;C:SSHCONTRIB // success


    *** But



    C:SSH>path 
    PATH=C:FDOSBIN
    C:SSH>set newdir=%cd%
    C:SSH>echo %newdir%
    ECHO is on // unexpected
    C:SSH>path=%path%;%newdir%
    C:SSH>path
    PATH=C:FDOSBIN;C:SSHCONTRIB //unchanged




    The "echo is on" as well as other failures are consistent with %cd% resolving to nothing.

    So CD, like PATH, appears to be a COMMAND whose output can be captured by evaluating it as a %VARIABLE%, but this is probably only the desired appearance. Sounds like the two are fundamentally different, and CD does not work consistently under COMMAND.COM.

    NOTE that there is another question floating around out there with a solution that works nicely under cmd.exe. This is not that.










    share|improve this question



























      0












      0








      0








      Goal: Issue a simple command to add the current directory to the PATH statement. Rather than type in every agonizing stroke, I would rather call a batch file, say xpath (where xpath.bat sits in an active path).
      Doesn't work: path=%path%;%cd% does not work under command.com, neither in batch nor on the command line, although it works perfectly in later cmd.exe systems.
      Confusing: Several other system variables or strings can be manipulated this way.



      %CD% (or CD) is behaving differently.



      Environment: I am using FreeDOS 1.2 under Virtualbox 5.2.22

      This failure is consistent under MS-DOS 6.22 also under Vbx 5.2.22





      C:SSH>path  
      PATH=C:FDOSBIN
      C:SSH>set newdir=C:SSHCONTRIB
      C:SSH>echo %newdir%
      C:SSHCONTRIB // success
      C:SSH>path=%path%;%newdir%
      C:SSH>path
      PATH=C:FDOSBIN;C:SSHCONTRIB // success


      *** But



      C:SSH>path 
      PATH=C:FDOSBIN
      C:SSH>set newdir=%cd%
      C:SSH>echo %newdir%
      ECHO is on // unexpected
      C:SSH>path=%path%;%newdir%
      C:SSH>path
      PATH=C:FDOSBIN;C:SSHCONTRIB //unchanged




      The "echo is on" as well as other failures are consistent with %cd% resolving to nothing.

      So CD, like PATH, appears to be a COMMAND whose output can be captured by evaluating it as a %VARIABLE%, but this is probably only the desired appearance. Sounds like the two are fundamentally different, and CD does not work consistently under COMMAND.COM.

      NOTE that there is another question floating around out there with a solution that works nicely under cmd.exe. This is not that.










      share|improve this question
















      Goal: Issue a simple command to add the current directory to the PATH statement. Rather than type in every agonizing stroke, I would rather call a batch file, say xpath (where xpath.bat sits in an active path).
      Doesn't work: path=%path%;%cd% does not work under command.com, neither in batch nor on the command line, although it works perfectly in later cmd.exe systems.
      Confusing: Several other system variables or strings can be manipulated this way.



      %CD% (or CD) is behaving differently.



      Environment: I am using FreeDOS 1.2 under Virtualbox 5.2.22

      This failure is consistent under MS-DOS 6.22 also under Vbx 5.2.22





      C:SSH>path  
      PATH=C:FDOSBIN
      C:SSH>set newdir=C:SSHCONTRIB
      C:SSH>echo %newdir%
      C:SSHCONTRIB // success
      C:SSH>path=%path%;%newdir%
      C:SSH>path
      PATH=C:FDOSBIN;C:SSHCONTRIB // success


      *** But



      C:SSH>path 
      PATH=C:FDOSBIN
      C:SSH>set newdir=%cd%
      C:SSH>echo %newdir%
      ECHO is on // unexpected
      C:SSH>path=%path%;%newdir%
      C:SSH>path
      PATH=C:FDOSBIN;C:SSHCONTRIB //unchanged




      The "echo is on" as well as other failures are consistent with %cd% resolving to nothing.

      So CD, like PATH, appears to be a COMMAND whose output can be captured by evaluating it as a %VARIABLE%, but this is probably only the desired appearance. Sounds like the two are fundamentally different, and CD does not work consistently under COMMAND.COM.

      NOTE that there is another question floating around out there with a solution that works nicely under cmd.exe. This is not that.







      batch-file path ms-dos cd freedos






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 26 at 5:35









      Appleoddity

      7,33521124




      7,33521124










      asked Jan 26 at 4:48









      Haakon DahlHaakon Dahl

      1907




      1907






















          1 Answer
          1






          active

          oldest

          votes


















          1














          ratburgerian. Just try and use a small DOS utility such as PATHA.COM or any similar one. Here is its syntax :



          PATHA [text or /c] [ /f /d /e /b /o ]

          PATHA provides various ways to modify the current path.



          PATHA : show current path.
          PATHA [text] : Add directory(s) [text] to the current path.



            OPTIONS

          • `[text]` : A single directory (i.e. c:DOS) or multiple directories separated by ;'s (i.e. c:;c:dos).

          • /c : use Current working directory as [text].

          • /b : add to the Beginning of the path.

          • /d : Delete from the path.

          • /e : Edit the resulting path before changing.

          • /o : Override checking if directory exist.

          • /f : replace path with path in File [text], or from autoexec.bat if [text] not entered.


              Note: options may be combined. (i.e. PATHA /c /e).  


          Copyright 1992 HGB Enterprises, All Rights Reserved. Ver 1.1



          The version I use is this one :



          patha .com 14112 15-04-1992 19:39 "patha.com"



          This does work with my real DOSes (M$ 6.22 and Novell 7.15) PCs.






          share|improve this answer


























          • Formatting completely ruined by StackExchange !

            – user990536
            Jan 27 at 10:53











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1398644%2fadd-cd-to-path-in-command-com-note-that-cmd-exe-fix-does-not-work%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          ratburgerian. Just try and use a small DOS utility such as PATHA.COM or any similar one. Here is its syntax :



          PATHA [text or /c] [ /f /d /e /b /o ]

          PATHA provides various ways to modify the current path.



          PATHA : show current path.
          PATHA [text] : Add directory(s) [text] to the current path.



            OPTIONS

          • `[text]` : A single directory (i.e. c:DOS) or multiple directories separated by ;'s (i.e. c:;c:dos).

          • /c : use Current working directory as [text].

          • /b : add to the Beginning of the path.

          • /d : Delete from the path.

          • /e : Edit the resulting path before changing.

          • /o : Override checking if directory exist.

          • /f : replace path with path in File [text], or from autoexec.bat if [text] not entered.


              Note: options may be combined. (i.e. PATHA /c /e).  


          Copyright 1992 HGB Enterprises, All Rights Reserved. Ver 1.1



          The version I use is this one :



          patha .com 14112 15-04-1992 19:39 "patha.com"



          This does work with my real DOSes (M$ 6.22 and Novell 7.15) PCs.






          share|improve this answer


























          • Formatting completely ruined by StackExchange !

            – user990536
            Jan 27 at 10:53
















          1














          ratburgerian. Just try and use a small DOS utility such as PATHA.COM or any similar one. Here is its syntax :



          PATHA [text or /c] [ /f /d /e /b /o ]

          PATHA provides various ways to modify the current path.



          PATHA : show current path.
          PATHA [text] : Add directory(s) [text] to the current path.



            OPTIONS

          • `[text]` : A single directory (i.e. c:DOS) or multiple directories separated by ;'s (i.e. c:;c:dos).

          • /c : use Current working directory as [text].

          • /b : add to the Beginning of the path.

          • /d : Delete from the path.

          • /e : Edit the resulting path before changing.

          • /o : Override checking if directory exist.

          • /f : replace path with path in File [text], or from autoexec.bat if [text] not entered.


              Note: options may be combined. (i.e. PATHA /c /e).  


          Copyright 1992 HGB Enterprises, All Rights Reserved. Ver 1.1



          The version I use is this one :



          patha .com 14112 15-04-1992 19:39 "patha.com"



          This does work with my real DOSes (M$ 6.22 and Novell 7.15) PCs.






          share|improve this answer


























          • Formatting completely ruined by StackExchange !

            – user990536
            Jan 27 at 10:53














          1












          1








          1







          ratburgerian. Just try and use a small DOS utility such as PATHA.COM or any similar one. Here is its syntax :



          PATHA [text or /c] [ /f /d /e /b /o ]

          PATHA provides various ways to modify the current path.



          PATHA : show current path.
          PATHA [text] : Add directory(s) [text] to the current path.



            OPTIONS

          • `[text]` : A single directory (i.e. c:DOS) or multiple directories separated by ;'s (i.e. c:;c:dos).

          • /c : use Current working directory as [text].

          • /b : add to the Beginning of the path.

          • /d : Delete from the path.

          • /e : Edit the resulting path before changing.

          • /o : Override checking if directory exist.

          • /f : replace path with path in File [text], or from autoexec.bat if [text] not entered.


              Note: options may be combined. (i.e. PATHA /c /e).  


          Copyright 1992 HGB Enterprises, All Rights Reserved. Ver 1.1



          The version I use is this one :



          patha .com 14112 15-04-1992 19:39 "patha.com"



          This does work with my real DOSes (M$ 6.22 and Novell 7.15) PCs.






          share|improve this answer















          ratburgerian. Just try and use a small DOS utility such as PATHA.COM or any similar one. Here is its syntax :



          PATHA [text or /c] [ /f /d /e /b /o ]

          PATHA provides various ways to modify the current path.



          PATHA : show current path.
          PATHA [text] : Add directory(s) [text] to the current path.



            OPTIONS

          • `[text]` : A single directory (i.e. c:DOS) or multiple directories separated by ;'s (i.e. c:;c:dos).

          • /c : use Current working directory as [text].

          • /b : add to the Beginning of the path.

          • /d : Delete from the path.

          • /e : Edit the resulting path before changing.

          • /o : Override checking if directory exist.

          • /f : replace path with path in File [text], or from autoexec.bat if [text] not entered.


              Note: options may be combined. (i.e. PATHA /c /e).  


          Copyright 1992 HGB Enterprises, All Rights Reserved. Ver 1.1



          The version I use is this one :



          patha .com 14112 15-04-1992 19:39 "patha.com"



          This does work with my real DOSes (M$ 6.22 and Novell 7.15) PCs.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 3 at 6:52









          Haakon Dahl

          1907




          1907










          answered Jan 27 at 10:51









          user990536user990536

          111




          111













          • Formatting completely ruined by StackExchange !

            – user990536
            Jan 27 at 10:53



















          • Formatting completely ruined by StackExchange !

            – user990536
            Jan 27 at 10:53

















          Formatting completely ruined by StackExchange !

          – user990536
          Jan 27 at 10:53





          Formatting completely ruined by StackExchange !

          – user990536
          Jan 27 at 10:53


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1398644%2fadd-cd-to-path-in-command-com-note-that-cmd-exe-fix-does-not-work%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Probability when a professor distributes a quiz and homework assignment to a class of n students.

          Aardman Animations

          Are they similar matrix