0

I need to change the second monitor's resolution when I login into an account.

I made a bat file which has a line ChangeScreenResolution.exe /w=1024 /h=768 /d=0 in it. I need it executed at login so whenever I enter a specific account the resolution changes to specified dimensions. I tried using task scheduler and use At Logon as a trigger but it didn't work. It throws 0x2 or 0xC0000005. I allowed the desired account to Log on as batch job in local politics. Another thing is that when I press Execute in the Task Scheduler interface, the task works, the resolution changes. But when I log out and in of the account, it throws errors.

Meanwhile If I choose At Unlock Working Machine, it works fine, I relogin with the desired resolution. I tried specifying paths to the .bat file in Start In property, tried using cmd.exe with the path to the bat as an argument. But with no avail. I require help of my peers because I've spent 6 hours already and my brain slowly deteriorates.

4
  • 1
    Have you tried simply putting a shortcut into the startup folder? Commented Aug 20, 2021 at 18:52
  • @SeñorCMasMas I wrote my answer while you posted the comment. I only noticed after I submitted my answer.
    – Tonny
    Commented Aug 20, 2021 at 18:56
  • Also, you don't need a batch file, just run the command. If using the startup folder, you can use a shortcut to ChangeScreenResolution.exe and specify the parameters. If using the task scheduler, you can specify the program directly. Commented Aug 20, 2021 at 19:47
  • Señor CMasMas , actually yeah, good point. Thanks, I can use .exe with arguments.
    – magrega
    Commented Aug 21, 2021 at 9:54

2 Answers 2

0

Don't use the At Logon trigger. It runs very early in the logon sequence and it is possible the display isn't properly intialized at that point.
Just place a shortcut to the BAT file in that users Startup folder (c:\Users<userid>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup)
Make the folder if it doesn't exist yet.

4
  • Actually, that was the first thing I tried but I considered it a bit slow, so I wanted somenthing more straight-on.
    – magrega
    Commented Aug 20, 2021 at 19:21
  • There is a reason that it is slower. That startup folder won't get called until everything is initialized that needs to be. Commented Aug 20, 2021 at 19:48
  • got it, thanks. I wish there were settigns for each account so I could just specify what resolution I want at login of a user.
    – magrega
    Commented Aug 21, 2021 at 9:55
  • By the way, is there a way to hide a popping cmd window when tasks execute? It flashes only for a brief moment but I'd like to hide it for aesthetic reasons.
    – magrega
    Commented Aug 21, 2021 at 10:01
0

The thing I did was I used At Logon trigger but delayed the task for 10 secs which is kind of same as putting a bat into the start-up folder. Well, I guess it is what it is.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .