Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: NT user logoff
Note: I have also tried options 2, 8, and 10 witht the IntControl(12....) function.
Debug (1) rc = IntControl(1005, 0, 0, 0, 0) If rc == @FALSE new=IntControl(1005, 1, 0, 0, 0) ; enter shutdown mode Endif rc = IntControl(12, 2, 0, 0, 0) ; if we got here, we're running in shutdown mode Display(1, "Windows Shutdown", "WinBatch shutdown processing begins now") RunWait("CMD.EXE", "/c Chkdsk")Do you know of another way of accomplishing my goals other than the one above?
After running the wbt file, WinBatch prompts me with the following dialog box when I try to logoff "Winbatch Shutdown Notification, Please close all other windows and then select OK, or select Cancel to stop the shutdown process".
How is WinBatch doing this (stopping the shutdown process)? I want to be able to duplicate this message and functionality with a winbatch script (or other language) - I do not want WinBatch itself prompting for this message.
How do I duplicate this action using winbatch or another language? All I want to do is:
From another program...
Process the WM_QUERYENDSESSION message.
Return FALSE to the above message.
WinExec is the easy one. CreateProcess is the official one
ExitWindowsEx
A user also provided the following invaluable information:
The only way to guarantee enough time to have the files copy before the shutdown happens is to control the ENTIRE shutdown process.
In our configurations, we have enabled a policy for the workstations (Win95 in this case, but NT works the same way) to disable SHUTDOWN on the menu. Then we copy a shortcut called SHUTDOWN.LNK into the Start Menu Folder of the machine (in our case this is pointing to a network drive, again using policies). This runs the SHUTDWN.EXE program, which uses Winbatch to present an interface to the user, copy files and shutdown the workstation using INT66,67 and 68 commands.
In the following SHUTDWN.WBT script, you can customize to your requirements.
We use this to allow copying user files to their Home directory so that Win16 application settings can "move around" with the user. The only prerequisite to this is that you MUST disable the Shutdown command for the users using POLEDIT on the Login directory and copy in the shortcut for the new shutdown (you can use an Icon Edit program to change the icon to whatever you want) into the users' Start menu. If you don't disable the Shutdown command, you will get TWO of them which is confusing to the users.
; Script to shutdown windows. This script will copy all the necessary ini files to the H: dirve ; and will shut down windows. It will prompt the user to close all files before shutting down. ;bug(@ON) sounds(0) ;Define Vars drive = "H:" ;Define the dialog format shdnFormat="WWWDLGED,5.0" shdnCaption="Windows 95 Shutdown" shdnx=110 shdny=100 shdnwidth=205 shdnheight=90 shdnnumcontrols=6 shdn01='15,15,170,DEFAULT,RADIOBUTTON,state,"&Shutdown the Computer?",1' shdn02='15,27,170,DEFAULT,RADIOBUTTON,state,"&Restart the Computer?",2' shdn03='15,39,170,DEFAULT,RADIOBUTTON,state,"&Close all programs and logon as a different user?",3' shdn04='30,60,40,DEFAULT,PUSHBUTTON,Default,"&Yes",1' shdn05='80,60,40,DEFAULT,PUSHBUTTON,Default,"&No",2' shdn06='130,60,40,DEFAULT,PUSHBUTTON,Default,"&Help",3' retval = 1 ; list of files to be copied up to network (c:\windows to h:\windows) ; session.ini,msmail.ini,trs.ini,odbc.ini,shlt*.ini,msacc20.ini,winproj4.ini ; pww.ini;"c:\Program Files\faxsrcli\faxsrwin.ini";c:\exchange\mailbox.pab While @TRUE retval = Dialog("shdn") switch retval case 1 switch state case 1 if DiskExist(drive) ErrorMode(@OFF) if FileExist ("h:\exchange\mailbox.pab") != 2 if FileExist ("c:\exchange\mailbox.pab") then FileCopy ("C:\EXCHANGE\MAILBOX.PAB", "H:\EXCHANGE\MAILBOX.PAB",@FALSE) endif if FileExist ("h:\windows\session.ini") != 2 if FileExist ("c:\windows\session.ini") then FileCopy ("C:\WINDOWS\SESSION.INI", "H:\WINDOWS\SESSION.INI",@FALSE) endif if FileExist ("h:\windows\msmail.ini") != 2 if FileExist ("c:\windows\msmail.ini") then FileCopy ("C:\WINDOWS\MSMAIL.INI", "H:\WINDOWS\MSMAIL.INI",@FALSE) endif if FileExist ("h:\windows\trs.ini") != 2 if FileExist ("c:\windows\trs.ini") then FileCopy ("C:\WINDOWS\TRS.INI", "H:\WINDOWS\TRS.INI",@FALSE) endif if FileExist ("h:\faxsrcli\faxsrwin.ini") != 2 if FileExist ("c:\Program Files\faxsrcli\faxsrwin.ini") then FileCopy ("C:\PROGRAM FILES\FAXSRCLI\FAXSRWIN.INI", "H:\FAXSRCLI\FAXSRWIN.INI",@FALSE) endif if FileExist ("h:\windows\odbc.ini") != 2 if FileExist ("c:\windows\odbc.ini") then FileCopy ("C:\WINDOWS\ODBC.INI", "H:\WINDOWS\ODBC.INI",@FALSE) endif if FileExist ("h:\windows\ers.ini") != 2 if FileExist ("c:\windows\ers.ini") then FileCopy ("C:\WINDOWS\ERS.INI", "H:\WINDOWS\ERS.INI",@FALSE) endif if FileExist ("h:\windows\shltrans.ini") != 2 if FileExist ("c:\windows\shltrans.ini") then FileCopy ("C:\WINDOWS\SHLT*.INI", "H:\WINDOWS\SHLT*.INI",@FALSE) endif if FileExist ("h:\windows\msacc20.ini") != 2 if FileExist ("c:\windows\msacc20.ini") then FileCopy ("C:\WINDOWS\MSACC20.INI", "H:\WINDOWS\MSACC20.INI",@FALSE) endif if FileExist ("h:\windows\winproj4.ini") != 2 if FileExist ("c:\windows\winproj4.ini") then FileCopy ("C:\WINDOWS\WINPROJ4.INI", "H:\WINDOWS\WINPROJ4.INI",@FALSE) endif if FileExist ("h:\windows\pww.ini") != 2 if FileExist ("c:\windows\pww.ini") then FileCopy ("C:\WINDOWS\PWW.INI", "H:\WINDOWS\PWW.INI",@FALSE) endif ErrorMode(@CANCEL) endif IntControl(68,0,0,0,0) exit case 2 if DiskExist(drive) ErrorMode(@OFF) if FileExist ("h:\exchange\mailbox.pab") != 2 if FileExist ("c:\exchange\mailbox.pab") then FileCopy ("C:\EXCHANGE\MAILBOX.PAB", "H:\EXCHANGE\MAILBOX.PAB",@FALSE) endif if FileExist ("h:\windows\session.ini") != 2 if FileExist ("c:\windows\session.ini") then FileCopy ("C:\WINDOWS\SESSION.INI", "H:\WINDOWS\SESSION.INI",@FALSE) endif if FileExist ("h:\windows\msmail.ini") != 2 if FileExist ("c:\windows\msmail.ini") then FileCopy ("C:\WINDOWS\MSMAIL.INI", "H:\WINDOWS\MSMAIL.INI",@FALSE) endif if FileExist ("h:\windows\trs.ini") != 2 if FileExist ("c:\windows\trs.ini") then FileCopy ("C:\WINDOWS\TRS.INI", "H:\WINDOWS\TRS.INI",@FALSE) endif if FileExist ("h:\faxsrcli\faxsrwin.ini") != 2 if FileExist ("c:\Program Files\faxsrcli\faxsrwin.ini") then FileCopy ("C:\PROGRAM FILES\FAXSRCLI\FAXSRWIN.INI", "H:\FAXSRCLI\FAXSRWIN.INI",@FALSE) endif if FileExist ("h:\windows\odbc.ini") != 2 if FileExist ("c:\windows\odbc.ini") then FileCopy ("C:\WINDOWS\ODBC.INI", "H:\WINDOWS\ODBC.INI",@FALSE) endif if FileExist ("h:\windows\ers.ini") != 2 if FileExist ("c:\windows\ers.ini") then FileCopy ("C:\WINDOWS\ERS.INI", "H:\WINDOWS\ERS.INI",@FALSE) endif if FileExist ("h:\windows\shltrans.ini") != 2 if FileExist ("c:\windows\shltrans.ini") then FileCopy ("C:\WINDOWS\SHLT*.INI", "H:\WINDOWS\SHLT*.INI",@FALSE) endif if FileExist ("h:\windows\msacc20.ini") != 2 if FileExist ("c:\windows\msacc20.ini") then FileCopy ("C:\WINDOWS\MSACC20.INI", "H:\WINDOWS\MSACC20.INI",@FALSE) endif if FileExist ("h:\windows\winproj4.ini") != 2 if FileExist ("c:\windows\winproj4.ini") then FileCopy ("C:\WINDOWS\WINPROJ4.INI", "H:\WINDOWS\WINPROJ4.INI",@FALSE) endif if FileExist ("h:\windows\pww.ini") != 2 if FileExist ("c:\windows\pww.ini") then FileCopy ("C:\WINDOWS\PWW.INI", "H:\WINDOWS\PWW.INI",@FALSE) endif ErrorMode(@CANCEL) endif IntControl(67,0,0,0,0) exit case 3 if DiskExist(drive) ErrorMode(@OFF) if FileExist ("h:\exchange\mailbox.pab") != 2 if FileExist ("c:\exchange\mailbox.pab") then FileCopy ("C:\EXCHANGE\MAILBOX.PAB", "H:\EXCHANGE\MAILBOX.PAB",@FALSE) endif if FileExist ("h:\windows\session.ini") != 2 if FileExist ("c:\windows\session.ini") then FileCopy ("C:\WINDOWS\SESSION.INI", "H:\WINDOWS\SESSION.INI",@FALSE) endif if FileExist ("h:\windows\msmail.ini") != 2 if FileExist ("c:\windows\msmail.ini") then FileCopy ("C:\WINDOWS\MSMAIL.INI", "H:\WINDOWS\MSMAIL.INI",@FALSE) endif if FileExist ("h:\windows\trs.ini") != 2 if FileExist ("c:\windows\trs.ini") then FileCopy ("C:\WINDOWS\TRS.INI", "H:\WINDOWS\TRS.INI",@FALSE) endif if FileExist ("h:\faxsrcli\faxsrwin.ini") != 2 if FileExist ("c:\Program Files\faxsrcli\faxsrwin.ini") then FileCopy ("C:\PROGRAM FILES\FAXSRCLI\FAXSRWIN.INI", "H:\FAXSRCLI\FAXSRWIN.INI",@FALSE) endif if FileExist ("h:\windows\odbc.ini") != 2 if FileExist ("c:\windows\odbc.ini") then FileCopy ("C:\WINDOWS\ODBC.INI", "H:\WINDOWS\ODBC.INI",@FALSE) endif if FileExist ("h:\windows\ers.ini") != 2 if FileExist ("c:\windows\ers.ini") then FileCopy ("C:\WINDOWS\ERS.INI", "H:\WINDOWS\ERS.INI",@FALSE) endif if FileExist ("h:\windows\shltrans.ini") != 2 if FileExist ("c:\windows\shltrans.ini") then FileCopy ("C:\WINDOWS\SHLT*.INI", "H:\WINDOWS\SHLT*.INI",@FALSE) endif if FileExist ("h:\windows\msacc20.ini") != 2 if FileExist ("c:\windows\msacc20.ini") then FileCopy ("C:\WINDOWS\MSACC20.INI", "H:\WINDOWS\MSACC20.INI",@FALSE) endif if FileExist ("h:\windows\winproj4.ini") != 2 if FileExist ("c:\windows\winproj4.ini") then FileCopy ("C:\WINDOWS\WINPROJ4.INI", "H:\WINDOWS\WINPROJ4.INI",@FALSE) endif if FileExist ("h:\windows\pww.ini") != 2 if FileExist ("c:\windows\pww.ini") then FileCopy ("C:\WINDOWS\PWW.INI", "H:\WINDOWS\PWW.INI",@FALSE) endif ErrorMode(@CANCEL) endif IntControl(66,0,0,0,0) exit endswitch break case 2 exit case 3 RunShell("c:\windows\help\overview.hlp", "", "C:\Windows\help", @NORMAL, @NOWAIT) break endswitch endwhile
Article ID: W13315
Filename: Moving Files during NT Shutdown-Logoff.txt
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38