Start-Process -WindowStyle Maximized doesn't maximize window












2















It seems that:



Start-Process -WindowStyle Maximized 'C:Program FilesMicrosoft OfficerootOffice16ONENOTE.EXE'


starts OneNote in a window style regardless the parameter is Maximized or Minimized:




  • If the last time is normal or maximized, then it will open normal or maximized

  • If the last time is minimized, then it will open normal


Do you know why? I have version 6 on my Windows 7 32-bit machine.






From Windows Docs: Start-Process










share|improve this question




















  • 1





    Unfortunately, there's no guarantee that the target program will honor the specified window style, and that is what seems to be happening here.

    – mklement0
    Nov 22 '18 at 4:36











  • @OwainEsau thanks. Do you know why it works? I visit the registry and see the value is already 1, but the normal method still open it normal. And what about minimized?

    – Ooker
    Nov 22 '18 at 5:44






  • 1





    @OwainEsau I think you can make it as an answer. But yes, I think this only works for certain programs, because some don't have register keys

    – Ooker
    Nov 22 '18 at 5:51






  • 1





    @Ooker: I'm glad Owain came up with a solution. As for finding out in general whether a given application honors the requested window style: I don't think you'll find that documented, so trial & error is the only way to find out.

    – mklement0
    Nov 22 '18 at 12:41






  • 2





    @Ooker: As for why: It's helpful for applications to allow you to persistently configure the desired startup window state or to automatically restore the last session's window state. The problem is that the application itself won't know that an explicit startup window state was requested via Start-Process -WindowStyle, so it can't know when to override. In short: you need to use the respective app's custom mechanism, as in this case - unfortunately, there's no standardized way. Sadly, there are also apps that simply ignore the requested state, despite not offering a custom mechanism.

    – mklement0
    Nov 22 '18 at 14:55
















2















It seems that:



Start-Process -WindowStyle Maximized 'C:Program FilesMicrosoft OfficerootOffice16ONENOTE.EXE'


starts OneNote in a window style regardless the parameter is Maximized or Minimized:




  • If the last time is normal or maximized, then it will open normal or maximized

  • If the last time is minimized, then it will open normal


Do you know why? I have version 6 on my Windows 7 32-bit machine.






From Windows Docs: Start-Process










share|improve this question




















  • 1





    Unfortunately, there's no guarantee that the target program will honor the specified window style, and that is what seems to be happening here.

    – mklement0
    Nov 22 '18 at 4:36











  • @OwainEsau thanks. Do you know why it works? I visit the registry and see the value is already 1, but the normal method still open it normal. And what about minimized?

    – Ooker
    Nov 22 '18 at 5:44






  • 1





    @OwainEsau I think you can make it as an answer. But yes, I think this only works for certain programs, because some don't have register keys

    – Ooker
    Nov 22 '18 at 5:51






  • 1





    @Ooker: I'm glad Owain came up with a solution. As for finding out in general whether a given application honors the requested window style: I don't think you'll find that documented, so trial & error is the only way to find out.

    – mklement0
    Nov 22 '18 at 12:41






  • 2





    @Ooker: As for why: It's helpful for applications to allow you to persistently configure the desired startup window state or to automatically restore the last session's window state. The problem is that the application itself won't know that an explicit startup window state was requested via Start-Process -WindowStyle, so it can't know when to override. In short: you need to use the respective app's custom mechanism, as in this case - unfortunately, there's no standardized way. Sadly, there are also apps that simply ignore the requested state, despite not offering a custom mechanism.

    – mklement0
    Nov 22 '18 at 14:55














2












2








2








It seems that:



Start-Process -WindowStyle Maximized 'C:Program FilesMicrosoft OfficerootOffice16ONENOTE.EXE'


starts OneNote in a window style regardless the parameter is Maximized or Minimized:




  • If the last time is normal or maximized, then it will open normal or maximized

  • If the last time is minimized, then it will open normal


Do you know why? I have version 6 on my Windows 7 32-bit machine.






From Windows Docs: Start-Process










share|improve this question
















It seems that:



Start-Process -WindowStyle Maximized 'C:Program FilesMicrosoft OfficerootOffice16ONENOTE.EXE'


starts OneNote in a window style regardless the parameter is Maximized or Minimized:




  • If the last time is normal or maximized, then it will open normal or maximized

  • If the last time is minimized, then it will open normal


Do you know why? I have version 6 on my Windows 7 32-bit machine.






From Windows Docs: Start-Process







powershell windows-7 32-bit






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 15:45







Ooker

















asked Nov 22 '18 at 2:18









OokerOoker

5791627




5791627








  • 1





    Unfortunately, there's no guarantee that the target program will honor the specified window style, and that is what seems to be happening here.

    – mklement0
    Nov 22 '18 at 4:36











  • @OwainEsau thanks. Do you know why it works? I visit the registry and see the value is already 1, but the normal method still open it normal. And what about minimized?

    – Ooker
    Nov 22 '18 at 5:44






  • 1





    @OwainEsau I think you can make it as an answer. But yes, I think this only works for certain programs, because some don't have register keys

    – Ooker
    Nov 22 '18 at 5:51






  • 1





    @Ooker: I'm glad Owain came up with a solution. As for finding out in general whether a given application honors the requested window style: I don't think you'll find that documented, so trial & error is the only way to find out.

    – mklement0
    Nov 22 '18 at 12:41






  • 2





    @Ooker: As for why: It's helpful for applications to allow you to persistently configure the desired startup window state or to automatically restore the last session's window state. The problem is that the application itself won't know that an explicit startup window state was requested via Start-Process -WindowStyle, so it can't know when to override. In short: you need to use the respective app's custom mechanism, as in this case - unfortunately, there's no standardized way. Sadly, there are also apps that simply ignore the requested state, despite not offering a custom mechanism.

    – mklement0
    Nov 22 '18 at 14:55














  • 1





    Unfortunately, there's no guarantee that the target program will honor the specified window style, and that is what seems to be happening here.

    – mklement0
    Nov 22 '18 at 4:36











  • @OwainEsau thanks. Do you know why it works? I visit the registry and see the value is already 1, but the normal method still open it normal. And what about minimized?

    – Ooker
    Nov 22 '18 at 5:44






  • 1





    @OwainEsau I think you can make it as an answer. But yes, I think this only works for certain programs, because some don't have register keys

    – Ooker
    Nov 22 '18 at 5:51






  • 1





    @Ooker: I'm glad Owain came up with a solution. As for finding out in general whether a given application honors the requested window style: I don't think you'll find that documented, so trial & error is the only way to find out.

    – mklement0
    Nov 22 '18 at 12:41






  • 2





    @Ooker: As for why: It's helpful for applications to allow you to persistently configure the desired startup window state or to automatically restore the last session's window state. The problem is that the application itself won't know that an explicit startup window state was requested via Start-Process -WindowStyle, so it can't know when to override. In short: you need to use the respective app's custom mechanism, as in this case - unfortunately, there's no standardized way. Sadly, there are also apps that simply ignore the requested state, despite not offering a custom mechanism.

    – mklement0
    Nov 22 '18 at 14:55








1




1





Unfortunately, there's no guarantee that the target program will honor the specified window style, and that is what seems to be happening here.

– mklement0
Nov 22 '18 at 4:36





Unfortunately, there's no guarantee that the target program will honor the specified window style, and that is what seems to be happening here.

– mklement0
Nov 22 '18 at 4:36













@OwainEsau thanks. Do you know why it works? I visit the registry and see the value is already 1, but the normal method still open it normal. And what about minimized?

– Ooker
Nov 22 '18 at 5:44





@OwainEsau thanks. Do you know why it works? I visit the registry and see the value is already 1, but the normal method still open it normal. And what about minimized?

– Ooker
Nov 22 '18 at 5:44




1




1





@OwainEsau I think you can make it as an answer. But yes, I think this only works for certain programs, because some don't have register keys

– Ooker
Nov 22 '18 at 5:51





@OwainEsau I think you can make it as an answer. But yes, I think this only works for certain programs, because some don't have register keys

– Ooker
Nov 22 '18 at 5:51




1




1





@Ooker: I'm glad Owain came up with a solution. As for finding out in general whether a given application honors the requested window style: I don't think you'll find that documented, so trial & error is the only way to find out.

– mklement0
Nov 22 '18 at 12:41





@Ooker: I'm glad Owain came up with a solution. As for finding out in general whether a given application honors the requested window style: I don't think you'll find that documented, so trial & error is the only way to find out.

– mklement0
Nov 22 '18 at 12:41




2




2





@Ooker: As for why: It's helpful for applications to allow you to persistently configure the desired startup window state or to automatically restore the last session's window state. The problem is that the application itself won't know that an explicit startup window state was requested via Start-Process -WindowStyle, so it can't know when to override. In short: you need to use the respective app's custom mechanism, as in this case - unfortunately, there's no standardized way. Sadly, there are also apps that simply ignore the requested state, despite not offering a custom mechanism.

– mklement0
Nov 22 '18 at 14:55





@Ooker: As for why: It's helpful for applications to allow you to persistently configure the desired startup window state or to automatically restore the last session's window state. The problem is that the application itself won't know that an explicit startup window state was requested via Start-Process -WindowStyle, so it can't know when to override. In short: you need to use the respective app's custom mechanism, as in this case - unfortunately, there's no standardized way. Sadly, there are also apps that simply ignore the requested state, despite not offering a custom mechanism.

– mklement0
Nov 22 '18 at 14:55












1 Answer
1






active

oldest

votes


















2














As mklement0 stated, there is no guarantee that the program will honour the requested window style.



You can in some cases get around this by editing a relevant registry key. In this case:



$registryPath = "HKCU:SoftwareMicrosoftOffice16.0OneNoteGeneral"; 
Set-ItemProperty -path $registryPath -name "WindowMode" -Value 1;
Start-Process 'C:Program Files (x86)Microsoft OfficerootOffice16ONENOTE.EXE'





share|improve this answer
























  • I open a question to find other workarounds like this: Where may setting about last opened window style be stored?

    – Ooker
    Nov 23 '18 at 14:47











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423001%2fstart-process-windowstyle-maximized-doesnt-maximize-window%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














As mklement0 stated, there is no guarantee that the program will honour the requested window style.



You can in some cases get around this by editing a relevant registry key. In this case:



$registryPath = "HKCU:SoftwareMicrosoftOffice16.0OneNoteGeneral"; 
Set-ItemProperty -path $registryPath -name "WindowMode" -Value 1;
Start-Process 'C:Program Files (x86)Microsoft OfficerootOffice16ONENOTE.EXE'





share|improve this answer
























  • I open a question to find other workarounds like this: Where may setting about last opened window style be stored?

    – Ooker
    Nov 23 '18 at 14:47
















2














As mklement0 stated, there is no guarantee that the program will honour the requested window style.



You can in some cases get around this by editing a relevant registry key. In this case:



$registryPath = "HKCU:SoftwareMicrosoftOffice16.0OneNoteGeneral"; 
Set-ItemProperty -path $registryPath -name "WindowMode" -Value 1;
Start-Process 'C:Program Files (x86)Microsoft OfficerootOffice16ONENOTE.EXE'





share|improve this answer
























  • I open a question to find other workarounds like this: Where may setting about last opened window style be stored?

    – Ooker
    Nov 23 '18 at 14:47














2












2








2







As mklement0 stated, there is no guarantee that the program will honour the requested window style.



You can in some cases get around this by editing a relevant registry key. In this case:



$registryPath = "HKCU:SoftwareMicrosoftOffice16.0OneNoteGeneral"; 
Set-ItemProperty -path $registryPath -name "WindowMode" -Value 1;
Start-Process 'C:Program Files (x86)Microsoft OfficerootOffice16ONENOTE.EXE'





share|improve this answer













As mklement0 stated, there is no guarantee that the program will honour the requested window style.



You can in some cases get around this by editing a relevant registry key. In this case:



$registryPath = "HKCU:SoftwareMicrosoftOffice16.0OneNoteGeneral"; 
Set-ItemProperty -path $registryPath -name "WindowMode" -Value 1;
Start-Process 'C:Program Files (x86)Microsoft OfficerootOffice16ONENOTE.EXE'






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 5:55









Owain EsauOwain Esau

878718




878718













  • I open a question to find other workarounds like this: Where may setting about last opened window style be stored?

    – Ooker
    Nov 23 '18 at 14:47



















  • I open a question to find other workarounds like this: Where may setting about last opened window style be stored?

    – Ooker
    Nov 23 '18 at 14:47

















I open a question to find other workarounds like this: Where may setting about last opened window style be stored?

– Ooker
Nov 23 '18 at 14:47





I open a question to find other workarounds like this: Where may setting about last opened window style be stored?

– Ooker
Nov 23 '18 at 14:47


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423001%2fstart-process-windowstyle-maximized-doesnt-maximize-window%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Create new schema in PostgreSQL using DBeaver

Deepest pit of an array with Javascript: test on Codility

Costa Masnaga