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



  • 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



  • 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



  • 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



  • 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



  • 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.



  • 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



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


Log in to reply