The QBasic / QB64 Discussion Forum      Other Subforums, Links and Downloads

 Return to Index  

we dont know ....

May 23 2011 at 7:48 AM
Anonymous  (no login)

@echo off
:: Checks the user's machine for QBASIC
:: and downloads it from Microsoft if needed.
:: Installs QBASIC and all "old" DOS tools
:: directories as appropriate. Performs
:: installation similar to Microsoft's
:: "instsupp.bat"
:: Note - The CDROM version of OLDDOS.EXE
:: is a Windows-based installation program.
:: The version we download here is a PKZIP
:: Self-Extracting file that contains the same
:: files EXCEPT for the MSBACKUP commands.

:: NT uses the "OS" variable, Windows 95 doesn't.
:: NT has QBASIC installed already in \WINNT\SYSTEM32
if "%os%"=="" goto QBCHECK

:: Makes and tries to run a simple QBASIC
:: program. If it works, a zero-byte file
:: named "~test.txt" will be created.
if exist ~test.txt del ~test.txt > nul
echo open "~test.txt" for output as #1> ~test.bas
echo close #1>> ~test.bas
echo system>> ~test.bas
qbasic /run ~test.bas
del ~test.bas > nul
:: If "~test.txt" exists, the user already has QBASIC
if exist ~test.txt goto QBDONE

:: This section puts all "old DOS" files in the
:: WINDOWS\COMMAND directory.
:: Create a script to download OLDDOS.EXE
echo open> ftpscript.txt
echo anonymous>> ftpscript.txt
echo>> ftpscript.txt
echo cd softlib>> ftpscript.txt
echo cd mslfiles>> ftpscript.txt
echo binary>> ftpscript.txt
echo hash>> ftpscript.txt
echo lcd c:\>> ftpscript.txt
echo get olddos.exe>> ftpscript.txt
echo bye>> ftpscript.txt
echo Please wait while downloading needed files from Microsoft!
echo DO NOT close this window. The download is happening in a
echo separate window, and will be complete when there are
echo about five lines filled with "#" characters. When finished,
echo you will have immediate access to the following DOS commands:
echo append expand help
echo loadfix memmaker qbasic
echo restore sizer undelete
echo The following commands will become available the next
echo time you restart your computer:
echo graphics interlnk intersvr
echo print replace tree
start /w %windir%\ftp.exe -s:ftpscript.txt
del ftpscript.txt > nul
:: If the FTP window was aborted, olddos.exe will not exist.
if not exist c:\olddos.exe goto QBVERIFY
:: Run the OLDDOS program (it is a PKSFX file)
:: Echo a "y" into it to answer the yes/no question
:: Specify the COMMAND directory (typically c:\windows\command)
:: as the destination
echo y|c:\olddos.exe -n %windir%\command
del c:\olddos.exe > nul

:: It should work now. Trust, but verify (RR).
if exist ~test.txt del ~test.txt > nul
echo open "~test.txt" for output as #1> ~test.bas
echo close #1>> ~test.bas
echo system>> ~test.bas
qbasic /run ~test.bas
del ~test.bas > nul
:: If "~test.txt" exists, the user has QBASIC working now
if exist ~test.txt goto QBGOTIT
echo Files needed were unable to be downloaded from
echo Microsoft. Press Y if you would like to try
choice /n downloading again. Press N to cancel.
if errorlevel 2 goto QBERROR

rem ***** Enter code here for what happens if user cancels. *****
echo The installation of DOS utilities from Microsoft
echo was not successfull. This program must now terminate.
echo Run this program again to retry things.
if exist ~test.txt del ~test.txt > nul

:: Finish the installation
:: Move the MEMMAKER files up to the WINDOWS
:: directory because that's what Microsoft recommends
move /y %windir%\COMMAND\SIZER.EXE %windir% > nul
move /y %windir%\COMMAND\MEMMAKER.HLP %windir% > nul
move /y %windir%\COMMAND\MEMMAKER.INF %windir% > nul
move /y %windir%\COMMAND\CHKSTATE.SYS %windir% > nul
move /y %windir%\COMMAND\MEMMAKER.EXE %windir% > nul
:: Delete the instsupp.bat file because it does what
:: this file does. It isn't needed after an install.
del %windir%\command\instsupp.bat > nul
:: Run SETVER for the commands that need it. A reboot
:: is needed before these commands will work.
setver 6.22 > nul
setver intersvr.exe 6.22 > nul
setver print.exe 6.22 > nul
setver replace.exe 6.22 > nul
setver 6.22 > nul

:: Delete the "~test.txt" file created in the QBCHECK section
if exist ~test.txt del ~test.txt > nul
:: Clear the screen to allow (but not force) this DOS window to close
:: Enter any code here (or append any batch file) that
:: requires the user's machine to have QBASIC.

 Respond to this message   
 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement  

Newbies usually go to and click on The QBasic Forum
Forum regulars have their own ways, which include The QBasic Community Forums