• Login
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.
  • D
    Dean Colpitts
    last edited by Jan 28, 2016, 12:43 AM

    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

    C 1 Reply Last reply Jan 28, 2016, 11:09 PM Reply Quote 1
    • C
      Claudia Frank @Dean Colpitts
      last edited by Jan 28, 2016, 11:09 PM

      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
      • F
        François Gardien
        last edited by Mar 3, 2016, 1:16 PM

        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

        C 1 Reply Last reply Mar 3, 2016, 2:48 PM Reply Quote 0
        • C
          Claudia Frank @François Gardien
          last edited by Mar 3, 2016, 2:48 PM

          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
          • F
            François Gardien
            last edited by Mar 4, 2016, 12:42 PM

            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.

            C 1 Reply Last reply Mar 4, 2016, 1:31 PM Reply Quote 0
            • C
              Claudia Frank @François Gardien
              last edited by Mar 4, 2016, 1:31 PM

              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
              • F
                François Gardien
                last edited by Mar 4, 2016, 8:49 PM

                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