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 -nosessioncommand 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.xmlto 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.logwill openchange.logusing the normal multi-instance rules- the alternate
notepad++ -settingsDir="c:\usr\local\apps\npp\altSettingsDir\" change.logwill 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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login