Community
    • Login

    using the command line switches, but not working

    Scheduled Pinned Locked Moved General Discussion
    2 Posts 2 Posters 56 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.
    • Dan McGovernD
      Dan McGovern
      last edited by

      so doing some interesting work on npp proper. now i have a good pipeline for all my projects. but the issue is using a batch file to run npp based on extension, current folder, etc and i cant get the switches to work together. this is what works
      “%np%” -settingsDir=“C:\Users\MyName\Roaming\Notepad++\batch” “%file%”

      but anytime i add this: “%np%” -openFoldersAsWorkspace %workspace%, it doesn’t matter where i put %file% or the other switches, it won’t work.

      basically i want to combine settingsdir, workspace, titleadd and others. what is the correct pattern for this?

      chatgpt said this should be the pattern, yet…
      start “” “%np%” “%file%” %general_flags% %workspace_flags%, i tried moving file to after general but that didn’t work.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Dan McGovern
        last edited by

        @Dan-McGovern ,

        -openFoldersAsWorkspace works just fine with -settingsDir and -titleAdd and other similar options, in my experiements.

        But, as far as I can tell, once -openFoldersAsWorkspace is specified anywhere on the command line, all path arguments are treated under the rule, “if it’s a folder, put it in the FolderAsWorkspace panel, and don’t open any file-paths directly”.

        That seems like the intent, because I don’t think it was considered that notepad++.exe myfile.txt -openFoldersAsWorkspace SomeDirectory\ would be a normal use-case (ie, when adding the feature, didn’t think that you’d want to open a file from one location, plus a folder-as-workspace from another, in the same command-line)

        If you don’t have the -multiInst argument, and if you don’t have the multi-instance preference set, then you could break it up into two calls of notepad++.exe

        "%np%" -settingsDir="..." -openFoldersAsWorkspace "%workspace%"
        "%np%" -settingsDir="..." "%file%"
        

        In that incantation, the oFAW has to come first, because of the known-and-never-solved issue that oFAW doesn’t work on an already-running instance of Notepad++.

        … But since I seem to remember that you do have the multi-instance preference set, that’s not likely to work for you. In which case, until you do a feature request, and it was accepted and implemented and released, I don’t know that you’ll get exactly what you want.

        I’ll update the manual to better explain current behavior with the oFAW option.

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