I have Windows 7 Professional. I wrote a file called spegnimento.bat with the following content:
case 1: shutdown /f
case 2: shutdown -f
case 3: shutdown /s
case 4: shutdown /l
If I save the file, close it, and then click it, I have the following results:
1) all files and programs are closed, then I'm logged off from Windows
2) same as 1)
3) all files and programs are closed, then the pc is shut down
4) same as 1)
However, if I ask the task manager to open the spegnimento.bat files at 6.35 pm, at that time I obtain the following results:
1) none
2) same as 1)
3) warning: the pc will be shut down in a minute. Then all files and programs are closed, and the pc is shut down
4) same as 1)
Question (a): Why do my clicks and the task manager have different results with same .bat files?
Question (b): What should I write in the .bat file so that the task manager at 6.35 pm opens it, then all files and programs are closed, and I am logged out of Windows (but the pc is not shut down)?
Thanks to @avery_larry.
I used the task scheduler's "Run only when user is logged on" setting, and it worked.
Question "b" has been satisfactorily answered, at it suffices. Thanks to @Gerhard Barnard and @Mofi for the superuser suggestion