Community
    • Login

    Feature Request - Command Line switch to create new file without prompting

    Scheduled Pinned Locked Moved General Discussion
    7 Posts 3 Posters 7.2k 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.
    • Dean ColpittsD
      Dean Colpitts
      last edited by

      We regularly work in the Windows Command Prompt (including a lot of cut and paste commands from other sources such as Outlook messages), and we start Notepad++ (including from in some of our pastes) from there using the command “start notepad++ filename.txt”. If filename.txt doesn’t exist, we are prompted to create new file. We’d like to request a simple switch be added to bypass this prompt (and answer yes automatically) if the file does not already exists. So something like “start notepad++ -new filename.txt”. The file already exists, then the switch should be ignored and filename.txt should open normally.

      Thanks

      dcc

      Claudia FrankC 1 Reply Last reply Reply Quote 1
      • Claudia FrankC
        Claudia Frank @Dean Colpitts
        last edited by

        Hello @Dean-Colpitts,

        in the meantime you could use a little batch script which can do this for you.
        So you don’t start npp directly but instead you use, let’s say,

        npp.bat filename
        

        In the batch file you have the following code

        if not exist %1 echo. > %1 
        start notepad++.exe %1
        

        if checks if the file exists and if not creates it then next line starts notepad with given filename.

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • François GardienF
          François Gardien
          last edited by

          To make a following question: how to load a session file by a command line… To be clear, I’d like to load several instances of the software (several Windows) with different sessions in these ones.
          Thanks

          Claudia FrankC 1 Reply Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank @François Gardien
            last edited by

            Hello @François-Gardien,

            there is a command line parameter -openSession which can be used to open a previous session.
            If you want to start different npp instances with different files then, of course, it is needed that you
            have stored the session of each npp instance with a different session file name.

            Available command line parameters can be found using ?->commmand line arguments

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 1
            • François GardienF
              François Gardien
              last edited by

              Command line runs a session ! It’s good but to open several instance I have to define option at Préférences>Multi-Instance>Always in multi-instance mode, else I have only one instance.
              Thanks.

              Claudia FrankC 1 Reply Last reply Reply Quote 0
              • Claudia FrankC
                Claudia Frank @François Gardien
                last edited by

                Hello @François-Gardien,

                correct, I assumed that you already had this.
                Just to be sure - there isn’t any open question for you, is it?

                Cheers
                Claudia

                1 Reply Last reply Reply Quote 0
                • François GardienF
                  François Gardien
                  last edited by

                  Don’t think to add anything. It’s OK !
                  Thanks.

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