Opening file with command line in an existing instance
-
I want to open a file via command line in cmd to an existing instance. I know I can set setting to default(mono-instance) in preference settings -> multi-instance setting. But I don’t want to use mono-instance normally, I only want to use mono-instance via cmd.
So is there any possible way to open file in as existing instance with cmd?, while multi-instance setting is on “always in multi-instance mode”.
-
@Eli-Grey said in Opening file with command line in an existing instance:
there any possible way to open file in as existing instance with cmd?, while multi-instance setting is on “always in multi-instance mode”.
No, but the opposite is easy: if you normally have notepad++ in mono-instance (via the settings), opening a single time in a separate instance from the command line is easy (with the
-multiInst -nosession
command line arguments)But, I suppose, if you have the normal settings (stored in
%AppData%\Notepad++
) with multi-instance enabled, you could run from the command line using an alternate settings directory. So- Copy
%AppData%\Notepad++\config.xml
to some alternate directory (I will use the examplec:\usr\local\apps\npp\altSettingsDir\config.xml
) - Edit that new config.xml, and
<GUIConfig name="multiInst" setting="2"
to<GUIConfig name="multiInst" setting="0"
. Save - From command line,
notepad++ change.log
will openchange.log
using the normal multi-instance rules- the alternate
notepad++ -settingsDir="c:\usr\local\apps\npp\altSettingsDir\" change.log
will use the alternate config file location, and thus not use multi-instance mode, and it will pick one of the already-open Notepad++ instances for editing the file
If you like that, you could set up a batch file in your path
npp-mono.bat
, which would call@notepad++ -settingsDir="c:\usr\local\apps\npp\altSettingsDir\" %*
, so that you wouldn’t have to type that long -settingsDir argument every time. - Copy
-
@PeterJones Oh my gosh, that’s all I needed. Thank you so much, I made batch file also, it makes me so comfortable.