• Login
Community
  • Login

$(CURRENT_DIRECTORY) is np++ directory

Scheduled Pinned Locked Moved General Discussion
5 Posts 2 Posters 575 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B
    BGM Coder
    last edited by BGM Coder Nov 28, 2020, 5:42 AM Nov 28, 2020, 5:42 AM

    Whilst trying to configure a RUN command, I discovered that $(CURRENT DIRECTORY) does not actually decipher to the current file’s directory when using comspec.

    For example, npp comes with this (in shortcuts.xml):

        <Command name="Open current dir cmd" Ctrl="no" Alt="no" Shift="no" Key="0">cmd /K cd $(CURRENT_DIRECTORY)</Command>
    

    But if you run that command, it opens notepad++ directory.

    However, for explorer, it works fine:

        <Command name="Open containing folder" Ctrl="no" Alt="no" Shift="no" Key="0">explorer $(CURRENT_DIRECTORY)</Command>
    

    Maybe I’m missing something or I’ve got something misfconfigured somehow?

    A 1 Reply Last reply Nov 28, 2020, 11:59 AM Reply Quote 0
    • A
      Alan Kilborn @BGM Coder
      last edited by Nov 28, 2020, 11:59 AM

      @BGM-Coder

      It’s hard to say conclusively from what you’ve provided, but if the tab in Notepad++ that is active when you invoke the cmd /K is on a different drive, I see the behavior you are talking about.

      I would try changing the cmd /K version of the command to:

      cmd /K cd /d $(CURRENT_DIRECTORY)

      The /d allows the drive to be changed when executing cd.
      See HERE for a nice reference.

      1 Reply Last reply Reply Quote 2
      • B
        BGM Coder
        last edited by Nov 28, 2020, 3:24 PM

        @Alan-Kilborn said in $(CURRENT_DIRECTORY) is np++ directory:

        cmd /K cd /d $(CURRENT_DIRECTORY)

        Thanks, Alan - that does work!

        I had been going by this list for cmd parameters, but for /d it had a funny description, so I never would have thought to use it as a switch for changing drives.

        A 1 Reply Last reply Nov 28, 2020, 3:37 PM Reply Quote 2
        • A
          Alan Kilborn @BGM Coder
          last edited by Nov 28, 2020, 3:37 PM

          @BGM-Coder said in $(CURRENT_DIRECTORY) is np++ directory:

          I had been going by this list for cmd parameters

          That’s fine; note that that site refers to parameters for “cmd” only.

          The /d that matters here is a parameter to the “cd” command, NOT the “cmd” command.

          Just for general knowledge, the \K, however, IS a parameter to “cmd”.

          Anyway, good that it now works for you.

          1 Reply Last reply Reply Quote 2
          • B
            BGM Coder
            last edited by Nov 28, 2020, 4:24 PM

            Thanks! That clears things up for me. I’m a bit richer now!

            1 Reply Last reply Reply Quote 2
            1 out of 5
            • First post
              1/5
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors