0

When I start Notepad++ from Start menu, the window has certain dimensions and the font size is as I've set it to last time. However, then I execute it from PowerShell, the window is much smaller and so is the font size.

I suspect that I'm not executing the program with me as the invoker. Is that correct and what can I do about it?

I've tried both Invoke-Item and Start-Process but they both produced the same result (and I'm not sure about the difference between them, despite googlearching).

function Edit{
  param([string]$file = " ")
  Invoke-Item 'C:\Program Files (x86)\Notepad++\notepad++.exe ' $file
  #Start-Process 'C:\Program Files (x86)\Notepad++\notepad++.exe' $file
}
Konrad Viltersten
  • 36,151
  • 76
  • 250
  • 438
  • Maybe from the start menu, you start the 64bit version of notepad++? – NineBerry Jan 13 '17 at 21:50
  • @NineBerry Good point. I've checked *c:\Program Files* though and there's no Notepad++ in there, only in the x86-dir. How do I start the 64-bitty version then? – Konrad Viltersten Jan 13 '17 at 21:52
  • Then you don't seem to have the 64bit version installed. How do you start the powershell script? Maybe from a service or from a planned task configured to run under a different user? – NineBerry Jan 13 '17 at 21:55
  • @NineBerry Nope. I run the function called `Edit` as shown in the question and it resides in `$PROFILE`. – Konrad Viltersten Jan 13 '17 at 21:57

1 Answers1

1

If you are using above windows 7.

If you run Notepad++ as your account it will run as your standard account however if you launch it form an admin PowerShell session you will be launching Notepad++ in an admin session as well, which causes the Notepad++ to use a 'seperate profile' for lack of a better way of explaining it.

Basically your standard account and your admin account, although they may be your account, they aren't the same profile and are able to have different settings.

Random206
  • 757
  • 6
  • 19
  • I guess it's a good thing, so that the profiles can have different behavior. However, I'd like to know how to execute NotePad++ from PowerShell in such a way so that I get the same appearance as I do when starting it from the menu. Suggestions? – Konrad Viltersten Jan 15 '17 at 19:06
  • @KonradViltersten this previous question should be able to help you out with this. http://stackoverflow.com/a/29271474 – Random206 Jan 15 '17 at 19:41