New
#21
Hhmm ok I'm going to make a new topic there and we will see if someone has an idea..
Hhmm ok I'm going to make a new topic there and we will see if someone has an idea..
That makes sense. It's trying to run another command as you and you're not logged in, so it fails. If this didn't work, an AHK script won't either as they're both doing the same thing. I wonder if it would work if you could run it as System, which is the privileges you're running with at the login screen. This could get very hairy, though, if we try to go that route. I know you can get a process to run as System by scheduling it with Task Scheduler in Windows. So, in theory, you could create a scheduled task to run your .bat file, then create another .bat to call the scheduled task to run immediately via the schtasks or AT command, which would launch the process as System and run the commands. Of course, this is all assuming SYSTEM commands would still be issued after logoff. Might be worth a shot.
I would guess the API was set up the way it was to try to avoid combining log off with the other functions. If it's a '0' you can't add it in. MS does some stuff by accident but I'm willing the give the benefit of the doubt it was deliberate. :)
Well, I think it has more to do with the simple succession of events rather than specific code attempting to prevent anything from happening after a logoff. The second command won't execute until the first completes. And, when the first completes, the user no longer has access on the system so it fails by design. This was the reasoning behind my wild idea of attempting to run the batch file as SYSTEM, given that SYSTEM has privileges while the user is logged in and still retains those privileges at the login screen after the user is logged out.
Services run as System. That's why I suggested it be written as a service initially. I suppose there's no way to know for sure until someone writes or finds one that works.
Update:
Log Off & Standby automatically is almost possible, simply using Task Scheduler.
Here there is the discussion : IDEA: Log off & Standby in 1-Click - DonationCoder.com
There are links for all kinds of shortcuts in Brink's tutorial if you scroll down to the bottom: Log Off Shortcut - Create
I solved with the suggestions given me here: IDEA: Log off & Standby in 1-Click - DonationCoder.com
Thanks MilesAhead !
Glad you got it going. To people on DonationCoder running Windows7 with questions I'm always linking to tutorials and solutions here, and with Vista to the Vista sister forum. So it's a 3 way street. All are excellent resources. :)
edit: for anyone trying to do the same thing, you should start reading the thread with this post:
http://www.donationcoder.com/forum/i...6612#msg266612
There are screen shots how to set up a Scheduled Task with logoff trigger. The posts that follow show how to Disable and Enable the task to avoid going into Standby on every logoff.