restore previous folder windows at logon minimised

Discussion in 'Windows 7' started by TziMmys, Nov 3, 2013.

  1. TziMmys

    TziMmys MDL Junior Member

    Aug 27, 2012
    73
    8
    0
    Good morning.

    I ude this function, but I have my windows minimized, and when I logon again, all windows are NOT minimized. Is there a way, at logon, all folders restored, would be minimized?

    Thanks...
     
  2. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,773
    1,080
    60
    #2 Mr Jinje, Nov 3, 2013
    Last edited by a moderator: Apr 20, 2017
    add a login script. This can run from a regular.cmd batch file.

    Minimize.cmd
    Code:
    start /wait /b powershell -command "$shell = New-Object -ComObject "Shell.Application";$shell.minimizeall()"
    Goes in this folder. (create it if necessary)

    Code:
    C:\Windows\System32\GroupPolicy\User\Scripts\Logon
     
  3. TziMmys

    TziMmys MDL Junior Member

    Aug 27, 2012
    73
    8
    0
    That was fast, thank you. But it did not worked. I tried with User, tried with my user name, both did not did the job :(
     
  4. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,773
    1,080
    60
    #4 Mr Jinje, Nov 3, 2013
    Last edited by a moderator: Apr 20, 2017
    I suspect it ran too early, before your desktop had even shown. Maybe a delay of 10-20 seconds to allow enough time for all the explorer windows to load before running the minimize.

    Also, do not muddle with the path or windows won't find it, the 'User' logon folder is a hard coded location that windows searches each logon and runs any scripts it finds. Likewise there is also a machine folder, but I don't want to get off-topic. Anyways, to fix the issue, I think either add this 'timeout' command and fix the User folder, or schedule the task via task scheduler with the delay. (or maybe an autoit exists already if your google-fu is strong enough)

    Code:
    timeout 20
    start /wait /b powershell -command "$shell = New-Object -ComObject "Shell.Application";$shell.minimizeall()"
    Useful locations.
    Code:
    C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown
    C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup
    C:\Windows\System32\GroupPolicy\User\Scripts\Logoff
    C:\Windows\System32\GroupPolicy\User\Scripts\Logon