Jump to content

Run Batch scripts on shutdown


smercer

Recommended Posts

MDGx

Just to make sure you speak english and not chinese:

in order to be able to exit Windows to native MS-DOS, like I do.

Then you need to run Windows from within a batch file,

Do you mean making a transition to an MS-DOS state between windows tasks end down and the power goes off, or do you mean restarting or sort-of restarting in MS-DOS mode, with a set of batch files?

Then how do run windows "from withion a batch file" if you exited windows?

In my conception, you can run only DOS program in DOS, windows program require windows... or that means that windows is still active somehow...

Unfortunately Chinese is not among the languages I speak. ;)

I meant native/pure/true MS-DOS, as in no WIN.COM leftover in memory nor vmm32.

If u read the pages I linked in previous post, you can achieve that too. :)

Necessary steps:

1. Move command.com from c:\windows to C:\ root.

2. Delete all files from C:\ root except autoexec.bat, config.sys, command.com, io.sys, msdos.sys, logo.sys and [if u like it like I do] winboot.ini:

http://www.mdgx.com/newtip16.htm#WBINI

and if u use NT4/2000/XP/2003/Longhorn [like I do], u also need to keep in C:\ root these other files:

BOOT.INI, BOOTSECT.DOS, NTDETECT.COM, NTLDR and eventually CMLDR if u installed C:\cmdcons .

If still using DOS 6.xx, u can also keep *.DOS + *.W40 files in C:\ root.

3. Change config.sys to include these lines [paths + files are mine, change to match yours]:

SWITCHES=/F
DOS=HIGH,UMB,AUTO
DEVICE=C:\MAX\UMBPCI.SYS
DEVICE=C:\MAX\HIRAM.EXE
DEVICE=C:\MAX\HIMEM.SYS /NUMHANDLES=120 /TESTMEM:OFF /Q
DEVICEHIGH=C:\MAX\IFSHLP.SYS
INSTALLHIGH=C:\MAX\SMARTDRV.EXE 10480 16 A- B- C+ D+ E+ F+ G+ H+ I+ /N /Q
INSTALLHIGH=C:\MAX\NOOFF.COM
BUFFERS=11,0
FILES=70
FCBS=1,0
LASTDRIVE=J
STACKS=0,0
SHELL=C:\COMMAND.COM C:\ /E:1024 /P /F
SET COUNTRY=001
SET PATH=C:\;C:\W98;C:\W98\SYSTEM;C:\BAT;C:\MAX;C:\ZIP;C:\3D;C:\SB16;D:\WMP;D:\WORDVIEW;..\
ACCDATE=C- D- E- F-

U can find UMBPCI.SYS + HIRAM.EXE here:

http://www.mdgx.com/umb.htm

Note that I moved himem.sys, smartdrv.exe, emm386.exe, ifshlp.sys, dblbuff.sys, mscdex.exe from C:\windows and from C:\windows\command to C:\MAX .

The line

SHELL=C:\COMMAND.COM /E:xxxx /P

is *essential* for this to work.

4. D/l + install NOOFF.COM into config.sys [see this page: http://www.mdgx.com/98-4.htm#98ATX ] so when u exit Windows to native MS-DOS, it won't shut off your PC, but it will go to the plain C:\ prompt, with no Windows module in memory.

5. Modifiy your C:\msdos.sys [and/or C:\winboot.ini if u use it] to include these lines:

[Options]
AutoScan=0
BootDelay=0
BootGUI=0
BootKeys=1
BootMenu=0
BootMenuDefault=1
BootMenuDelay=0
BootMulti=1
BootWin=1
DblSpace=0
DisableLog=1
DoubleBuffer=0
DrvSpace=0
LoadTop=0
Logo=1
Network=1
SystemReg=0

Complete MSDOS.SYS reference:

http://www.mdgx.com/msdos.htm

Note that I've disabled scandisk upon boot, double buffer and registry scanner.

6. Autoexec.bat can be safely deleted, if u need SET <variable>=xxxxxxxx lines u can add them all to your config.sys instead. Example [most apply only to my computer]:

SET PROMPT= [0;33mMDGx [1;m HI+UMB: [0;31mWin[1;mDO[0;31mw[1;mS [0;31m98 SE$_[36m$P$G
SET WINPMT= [0;33mDOS box [1;m Hit Insert 2 ÄÙ 2 Windows$_[36m$P$G
SET TEMP=D:\TEMP
SET TMP=D:\TEMP
SET PKTMP=D:\TEMP
SET DOS16M=2
SET CLASSPATH="C:\W98\SYSTEM\QTJAVA.ZIP"
SET QTJAVA="C:\W98\SYSTEM\QTJAVA.ZIP"
SET MOUSE=C:\MAX
SET COPYCMD=/Y
SET DIRCMD=/A/O:GEN/P/V
SET FX_GLIDE_NO_SPLASH=1
SET TZ=MST7MDT
SET CTCM=C:\SB16
SET SOUND=C:\SB16
SET BLASTER=A220 I5 D1 H5 P330 E620 T6
SET MIDI=SYNTH:1 MAP:E MODE:0

I do keep C:\autoexec.bat so I can run C:\WIN.BAT from it [see below for explanation].

My C:\autoexec.bat [paths + files apply only to my PC]:

@CTTY NUL
C:\3D\FASTVID.EXE 1X1 128 C0000000
LOADHIGH=C:\MAX\XMSDSK.EXE 81920 H: /T /Y
IF NOT EXIST H:\TEMP\NUL MKDIR H:\TEMP
IF NOT EXIST D:\TEMP\CACHE\NUL MKDIR D:\TEMP\CACHE
LOADHIGH=C:\MAX\RECALL.COM -I
LFNFOR ON
SET PROMPT= [0;33mMDGx [1;m HI+UMB: [0;31mWin[1;mDO[0;31mw[1;mS [0;31m98 SE$_[36m$P$G
SET WINPMT= [0;33mDOS box [1;m Hit Insert 2 ÄÙ 2 Windows$_[36m$P$G
C:\SB16\CTCM.EXE /B
C:\SB16\AWEUTIL.COM /S /EM:GM /R:0 /C:0
C:\SB16\MIXERSET.EXE /P /Q
IF EXIST C:\CTPNP.CFG DEL C:\CTPNP.CFG
C:\MAX\MODE.COM CON: RATE=32 DELAY=1
C:\MAX\ATTRIB.EXE +A -H -R -S C:\*.*
IF EXIST C:\LOGO.SYS DEL C:\LOGO.SYS
C:\MAX\PAPER.EXE F:\BMP\LOGO.ZIP C:\ZIP\PKUNZIP.EXE /NR
IF EXIST C:\WALPAPER.BMP RENAME C:\WALPAPER.BMP LOGO.SYS
SET TEMP=D:\TEMP
SET TMP=D:\TEMP
SET PKTMP=D:\TEMP
SET DOS16M=2
SET CLASSPATH="C:\W98\SYSTEM\QTJAVA.ZIP"
SET QTJAVA="C:\W98\SYSTEM\QTJAVA.ZIP"
SET MOUSE=C:\MAX
SET COPYCMD=/Y
SET DIRCMD=/A/O:GEN/P/V
SET FX_GLIDE_NO_SPLASH=1
SET TZ=MST7MDT
SET CTCM=C:\SB16
SET SOUND=C:\SB16
SET BLASTER=A220 I5 D1 H5 P330 E620 T6
SET MIDI=SYNTH:1 MAP:E MODE:0
LOADHIGH=C:\MAX\CTMOUSE.EXE /P /R44
CTTY CON
@ECHO OFF
TYPE C:\BAT\KEY.TXT
CLS
ECHO [1;30mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
ECHO ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[34mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[30mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
ECHO ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[34mÛÛ[31m Windows 98 SE + MS-DOS 7.10 [34mÛÛ[30mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
ECHO ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[34mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[30mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
ECHO ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
C:\WIN.BAT

7. Optional: u can use my modded WIN.COM to exit to native MS-DOS [only if NOOFF.COM is already loaded in memory] even when u run:

RUNDLL.EXE USER.EXE,ExitWindowsExec

If u decide to use my modded win.com, the only way to reboot your PC now is to run this command:

RUNDLL32 %windir%\SYSTEM\SHELL32.DLL,SHExitWindowsEx 2

Complete guide here:

http://www.mdgx.com/98-4.htm#98ATX

8. If u followed all steps so far, you will be able to boot to native MS-DOS instead of Windows UI, and then u can run WIN.COM or WIN.BAT [i mentioned it in previous post] to load Windows.

Example of WIN.BAT, which in my case must reside in C:\ root [paths + files apply only to my PC]:

@CTTY NUL
VER | FIND.EXE/I " 98"
IF ERRORLEVEL 1 GOTO NX
MEM.EXE/C | FIND.EXE/I "vmm32"
IF NOT ERRORLEVEL 1 GOTO NX
IF NOT EXIST F:\BMP\1024.ZIP GOTO N0
IF NOT EXIST F:\BMP\WALPAPER.BMP GOTO N0
F:
CD\BMP
IF EXIST C:\MAX\RAM\PAPER.EXE C:\MAX\RAM\PAPER.EXE F:\BMP\1024.ZIP C:\ZIP\PKUNZIP.EXE /NR
IF EXIST C:\MAX\RAM\OMBRA.EXE C:\MAX\RAM\OMBRA.EXE /Q /S F:\BMP\WALPAPER.BMP
:N0
MEM.EXE/C | FIND.EXE/I "NOOFF"
IF ERRORLEVEL 1 LOADHIGH=C:\MAX\RAM\NOOFF.COM
IF NOT EXIST D:\TEMP\CACHE\NUL MKDIR D:\TEMP\CACHE
C:
CD\
@CTTY CON
@ECHO OFF
IF EXIST C:\BAT\KEY98.TXT TYPE C:\BAT\KEY98.TXT
IF EXIST %winbootdir%\WIN.COM %winbootdir%\WIN.COM %1 %2 %3
IF EXIST C:\MAX\SMARTDRV.EXE C:\MAX\SMARTDRV.EXE /C
CLS
ECHO [1;30mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
ECHO ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[34mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[30mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
ECHO ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[34mÛÛ[31m Native MS-DOS 7.10 Mode ACTIVE ! [34mÛÛ[30mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
ECHO ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[34mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[30mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
ECHO ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[0;m
IF EXIST C:\BAT\KEY.TXT TYPE C:\BAT\KEY.TXT
@CTTY NUL
C:
CD\
:NX
@CTTY CON
@ECHO OFF
EXIT

Note that ECHO colored code above needs ANSI.SYS [or better replacement] loaded in config.sys.

NANSI.SYS is the best + fastest:

NANSI.SYS v4.0a 16-bit DOS ANSI CONsole Driver Accelerator TSR fastest and

most versatile Microsoft ANSI.SYS replacement for MS-DOS 5/6 and Windows 9x/ME

with built-in support for key remapping [also part of FreeDOS:

http://www.freedos.org/]:

http://www.kegel.com/nansi/

Direct download [59 KB, free GPL]:

http://www.coli.uni-sb.de/~eric/stuff/soft...rs/nansi40a.zip

Uses 3.2 KB of upper DOS RAM if loaded with DEVICEHIGH in CONFIG.SYS (upper

memory manager required in CONFIG.SYS).

NANSI.SYS ASCII sequences can be used to create colorful DOS prompts, start

ANY DOS/Windows program at the touch of a key by remapping ANY keys on ANY 101

(or more keys) enhanced keyboard etc.

See "F1-F12 Remapping = MS-DOS Mode + ANSI Driver" in DOSTIPS.TXT (part of W95-11D.EXE) for details.

I'm doing this since Win95 FE came out, and works with ALL Win9x releases, even up to WinME, but only if u modded WinME [a.k.a. MS-DOS 8.00] boot files to allow access to native MS-DOS:

Unofficial Windows ME Real DOS-Mode Patch v1.3 16-bit modifies COMMAND.COM +

IO.SYS (from C:\Windows\Command\EBD) and REGENV32.EXE (from C:\Windows\System)

to reenable native MS-DOS boot option and use custom AUTOEXEC.BAT + CONFIG.SYS

files (the Windows 95/98 style) to run MS-DOS based apps/games that do NOT

work from a Windows DOS session:

http://www.geocities.com/mfd4life_2000/

Direct download [9 KB, freeware]:

http://www.geocities.com/mfd4life_2000/mfddme13.zip

HowTo Guide:

http://www.dewassoc.com/support/winme/real_dos.htm

More info:

http://users.iafrica.com/c/cq/cquirke/me-dos.htm

See MEMORY.TXT (part of W95-11D.EXE) for complete memory management guidelines, and learn

how to tweak your AUTOEXEC.BAT + CONFIG.SYS to free MAXimum conventional DOS

memory.

When I say I exit Windows to native MS-DOS, I don't mean to run "Exit To DOS.PIF", which only starts a new command.com instance, and leaves WIN.COM in memory.

From this MS-DOS prompt [almost native MS-DOS, but not quite :)] u can return to Windows UI by simply typing EXIT and hitting Enter.

Details on how this works here:

http://www.mdgx.com/newtip10.htm#EXIT2DOS

Conclusion:

I boot to native/pure/true/real MS-DOS mode.

I start Windows 98SE from C:\WIN.BAT.

I exit Windows back to native/pure/true/real MS-DOS mode by simply shutting it down normally.

I reload Windows UI from C:\WIN.BAT as many times as I want, without rebooting.

Hope this helps.

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...