Jump to content

A W98 Essential


snuz2

Recommended Posts

I made this long, long ago, and thought someone might be interested in this...

This utility deletes folders and files from the temp directory after several days from creation. Time should be a safe test to delete them, even if some app puts something there expecting it to be present on restart or a partial download is there that you don't want cleared on startup. It is a DOS32 app that I run minimized at startup. You'd be surprised how much crap can accumulate in the TEMP directory. Afaik, Windows ( even XP ) never cleans up the temp directory. So here it is with source code.

cleantmp.zip

Link to comment
Share on other sites


Thanks!

Til now, I've used the following batch file when required (I also have DR-DOS, so take advantage of 'xdel') :

@echo off

if $%1==$/? goto help

if $%1==$/h goto help

if $%1==$/H goto help

if $%tmp%==$ goto lost

rem A sneaky way to change drive

%tmp%\

rem Now also change directory

cd %tmp%

c:\drdos.60\xdel /s /r /d %tmp%

goto end

:help

echo Deletes the MS-W temporary directory (TMP).

goto end

:lost

echo Huh? Where's MS-W temporary directory (TMP) ?!

:end

However, this doesn't check age of files or directories, so your solution should be better.

Joe.

Link to comment
Share on other sites

C:\Temp on my Win98 contains a file Ndd32.dat, which should not be deleted. It contains the settings of the standalone Norton Disk Doctor. No idea how to have standalone NDD read its settings from a different location. Under WinXP, however, standalone NDD does not use a Temp directory to store its settings.

Having an essential file in C:\Temp is a sore in the eye. Any ideas on how to fix this?

I am a little skeptical about the automatic deletion of stuff in Temp folders. Sometimes, esp. right after the installation of software and before rebooting, it contains interesting stuff like .msi files.

Under Win98 I have a shortcut to C:\Temp on the desktop, to check what's going on in C:\Temp. Under WinXP I have several desktop shortcuts to the various Temp folders.

Link to comment
Share on other sites

C:\Temp on my Win98 contains a file Ndd32.dat, which should not be deleted. It contains the settings of the standalone Norton Disk Doctor. No idea how to have standalone NDD read its settings from a different location. Under WinXP, however, standalone NDD does not use a Temp directory to store its settings.

Having an essential file in C:\Temp is a sore in the eye. Any ideas on how to fix this?

I am a little skeptical about the automatic deletion of stuff in Temp folders. Sometimes, esp. right after the installation of software and before rebooting, it contains interesting stuff like .msi files.

Under Win98 I have a shortcut to C:\Temp on the desktop, to check what's going on in C:\Temp. Under WinXP I have several desktop shortcuts to the various Temp folders.

The temporary directory in question isn't normally C:\Temp. Is that really where your %tmp% directory points?

Joe.

Link to comment
Share on other sites

The temporary directory in question isn't normally C:\Temp. Is that really where your %tmp% directory points?

Autoexec.bat contains 2 lines:

set temp=C:\TEMP

set tmp=C:\TEMP

Not sure what I needed the 2nd entry for. E:\<windows>\Temp\ nearly always stays empty; on rare occasions, maybe years ago, it contained some junk.

I made System Commander, when loading WinXP, to load at boot time a dummy autoexec.bat, because WinXP processes SET and PATH statements of a left-over C:\autoexec.bat (e.g. of a prior boot into Win98), which in some circumstances causes problems under WinXP. To make double-sure I also have disabled the processing of autoexec.bat under WinXP with TweakUI.

NDD probably does not save its settings file Ndd32.dat in C:\Temp under WinXP because the dummy autoexec.bat for WinXP does not contain the line:

set temp=C:\TEMP

In a multibooting environment it might be advisable to set different Temp folders for each opsys, to avoid a potential source of cross-infection between installed operating systems, as happened to me during infection with the Tenga virus. The Tenga.a virus is a most awesome virus, maybe developed by the military for the purpose of destroying software archives. The Stuxnet virus is just a well-publicized military virus, used against Iran. In Iran there appears to exist an outstanding software archive and one could imagine that it was also attacked by a military virus like Tenga.a, to delay recovery operations from the attack with the Stuxnet virus.

Edited by Multibooter
Link to comment
Share on other sites

The temporary directory in question isn't normally C:\Temp. Is that really where your %tmp% directory points?

Autoexec.bat contains 2 lines:

set temp=C:\TEMP

set tmp=C:\TEMP

Not sure what I needed the 2nd entry for. E:\<windows>\Temp\ nearly always stays empty; on rare occasions, maybe years ago, it contained some junk.

Well, that's unfortunate. In that case, it is probably not safe for you to clear out your %tmp% directory.

Normally this directory and associated environment variable is created automatically. If you use a separate %temp% directory, it's then much easier to delete those left-overs that inevitably accumulate.

Joe.

Link to comment
Share on other sites

The temporary directory in question isn't normally C:\Temp. Is that really where your %tmp% directory points?

Autoexec.bat contains 2 lines:

set temp=C:\TEMP

set tmp=C:\TEMP

Not sure what I needed the 2nd entry for. E:\<windows>\Temp\ nearly always stays empty; on rare occasions, maybe years ago, it contained some junk.

Well, that's unfortunate. In that case, it is probably not safe for you to clear out your %tmp% directory.

Normally this directory and associated environment variable is created automatically. If you use a separate %temp% directory, it's then much easier to delete those left-overs that inevitably accumulate.

He's probably ok because AUTOEXEC in this case should be redundant occuring after the registry initialized where the environment strings most likely were set already.. Remember that since Win95 both AUTOEXEC.BAT and CONFIG.SYS have been truly optional (and if you have been at this game since the DOS 2.xx era you will remember just how big a change that was).

Those global environment variables are seen as registry strings named "Temp" and "Tmp" and are loaded from:

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager\Environment]

Please note that there may also be a similar key with \Session Manager\ (note the space). I could never figure out if the latter one was a remnant from Win95 where it is actually mentioned in the HLP Resource Kit. The \SessionManager\ key is at least from Win98 as it appears in the CHM Resource Kit. I have always duplicated both just to be sure.

However, while this is all interesting, a better question might be why one would use a global environment variable in any risky situation. Being by definition both global and variable should give pause to a careful person! I mean anyone can change the contents of %temp%. Any batch file, any application, any user (if someone actually uses multiple users on Win9x)! Some random bad ideas:

set TEMP=C:\Windows

del /y %TEMP%\*.*

set TEMP="C:\My Documents"

rd %TEMP% <CRLF

set DRIVE=C:\

format %DRIVE% /Q <CRLF

Well you get the idea! (note that CRLF represents a dummy file containing a single <ENTER> keystroke, and it used to work and might still, but I am not sure). I also just remembered that MSDOS.SYS also can initialize the environment so there is another vector that can be exploited by the bad guys.

Anyway, IMHO, all directory removal and *.* deletes should always be spelled out by hand and not automated. But to each his own!

Edited by CharlotteTheHarlot
Link to comment
Share on other sites

Those global environment variables are seen as registry strings named "Temp" and "Tmp" and are loaded from:

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager\Environment] Please note that there may also be a similar key with \Session Manager\ (note the space).

Hi CharlotteTheHarlot,

I checked the registry, HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment contains the entry Path, with the value ";H:\IsoBuster", but nothing else

The key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager [i.e. without a space] has no Environment subkey

So apparently these 2 global variables are not there in the Win98 registry.

I have checked the old Inspiron 7500 laptop, it's been my main computer since June 2000. The last installation of Win98SE on it was 7 years ago, in October 2003. The autoexec.bat file created then already contained the 2 lines:

set temp=C:\TEMP

set tmp=C:\TEMP

Another autoexec.bat file used in Oct.2003 contained the 2 lines:

set temp=c:\TEMP

set tmp=C:\

When I checked under WinXP the environment variables ( -> Control Panel -> System -> Advanced tab -> Environment Variables button), I found 2 user variables TEMP AND TMP, and 2 system variables TEMP and TMP. TEMP and TMP were pointing to the same directories, even if WinXP was loaded by System Commander with an autoexec.bat containing no entries TEMP and TMP. WinXP had earlier used the autoexec.bat left from earlier boots into Win98 until I created a dummy autoexec.bat for WinXP. Maybe WinXP keeps these environment variables in the registry if ever loaded via autoexec.bat, while Win98 doesn't.

I got curious about this tmp variable and have searched the HDD for the string "tmp", with 3 interesting results:

1) The file \windows\SYSTEM\Hptcpmui.dll [description: Standard TCP/IP Port Monitor DLL] contains the string "c:\tmp\UIDbgMon.out"

2) The file \windows\SYSTEM\Hpbcom.dll [description: HP IEEE-1284 Driver] contains the string C:\TMP\TRACE.LOG

Both files were possibly part of the software I dug out to print from the Inspiron 7500 under Win98 via Ethernet cable directly to the HP2605dn Color LaserJet printer. I currently have no folder C:\Tmp\ on the laptop, maybe I didn't restore it after the infection with the Tenga.a virus. I have created an empty folder C:\Tmp\ now, maybe it's needed.

3) \windows\Scanreg.ini contains the 3 lines:

;Backup directory where the cabs are stored is

; <windir>\sysbckup by default. Value below overrides it.

; It must be a full path. ex. c:\tmp\backup

a better question might be why one would use a global environment variable in any risky situation. Being by definition both global and variable should give pause to a careful person! I mean anyone can change the contents of %temp%.
I just don't remember whether TEMP and TMP were set by the installer of some ancient software, or by me intentionally. I would guess probably by me intentionally:

The HDD on my old Inspiron 7500 laptop still has a now outdated partition layout, initially set up in such a way that I could recover/repair the HDD under DOS 6.22. 7 years ago I didn't trust Win98 and DOS 7 yet. DOS 6.22 can only see FAT16 partitions up to 2GB. This is much too small for the Win98 partition, so I eventually installed software to a program/data partition H:, a now 30GB FAT32 partition, which could not be accessed by DOS 6.22, while Win98 with its folders \Program Files\ and \windows\ could be accessed under DOS 6.22 on E: (2GB, FAT16).

Space on this 2GB Win98 partition is precious, so I probably forced software installers to use the C:\ partition (boot drive, 2GB FAT, nearly empty because no windows opsys was installed on it) for their temporary files. So the line "set temp=c:\TEMP" in autoexec.bat enabled me to install big software, even if the E: Win98 partition was only 2GBs in size.

Within the next few months I actually intend to completely change the partition layout on my old Inspiron 7500, converting the Win98 partition from 2GB FAT16 to probably 8GB FAT32 and moving about 80 applications from the program/data partition H: back to the Win98 ppartition E: In 2004 I used Application Mover v2.6 to move applications from E: to H:, now hopefully it will work in moving the 80 applications from H: back to a resized E: The main benefit of having both Win98 and the installed programs on the same partition is to be able to backup the whole Win98 opsys with a Ghost partition backup.

Anyway, IMHO, all directory removal and *.* deletes should always be spelled out by hand and not automated. But to each his own!
I would definitely agree, I am a little on the cautious side, but this shouldn't exclude that there are special uses for cleantmp.exe BTW, the MiTeC EXE Explorer couldn't look into it. Does it work Ok on FAT32 partitions? Edited by Multibooter
Link to comment
Share on other sites

I checked the registry, HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment contains the entry Path, with the value ";H:\IsoBuster", but nothing else

The key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager [i.e. without a space] has no Environment subkey. So apparently these 2 global variables are not there in the Win98 registry.

Not a subkey, they are strings (data names and values). Export the whole registry and then text search for "temp" WITH quotes but WITHOUT case-sensitivity. Here is what should be found (well, these are only some of the values I have in that key):

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager\Environment]"Path"="C:\\Windows;C:\\Windows\\Command"
"Prompt"="$p$g"
"Temp"="C:\\Temp"
"Tmp"="C:\\Temp"
"WinBootDir"="C:\\Windows"
"WinDir"="C:\\Windows"

A simple experiment is to rename the AUTOEXEC.BAT to something and then reboot. Then, immediately get into a command prompt and type: SET. Take note of the environment strings. If they are not there.you can insert those two registry values and reboot again and check SET once more. See what happens.

I just took a peek into the Win98 Resource Kit (Rk98book.chm) and found the pertinent information about SessionManager ...

System Subtree in HKEY_LOCAL_MACHINE

The data in HKEY_LOCAL_MACHINE\System is organized into control sets that contain a complete set of parameters for device drivers and services that can be loaded with Windows 98. All data that controls startup is described in the CurrentControlSet subtree under HKEY_LOCAL_MACHINE\System. This control set has two parts:

The Control key contains information used to control system startup, including the computer’s network name and the subsystems to start.

The Services key contains information to control the loading and configuration of drivers, file systems, and so on. The data in the

Services key also controls how these services call each other.

Control subkey.

The Control subkey contains startup parameters for the system, including settings for startup and shutdown, file system performance, keyboard layouts and language support, and so on. Table 31.13 describes some typical Control subkeys.

Subkey Contents

ComputerName The computer name, which should be set using the Network option in Control Panel.

FileSystem The type and settings of the file system.

IDConfigDB The identification for the current configuration.

Keyboard layouts A list of the DLLs for the keyboard language, which should be set using the Keyboard option in Control Panel.

Resources Descriptions and driver information for multimedia components.

NetworkProvider Descriptions of the network providers.

Nls Contains information on national language support, including language and locale preferences, which should be set using the Keyboard option in Control Panel.

PerfStats Statistics gathered from system components that can be viewed using System Monitor.

Print Contains information about the current printers and printing environment, contained in several subkeys:

Environments, which can contain subkeys defining drivers and print processors for operating system environments.

Monitors, which can contain subkeys with data for specific network printing monitors.

Printers, which can contain subkeys describing printer parameters for each installed printer.

Providers, which can contain subkeys describing DLLs for network print services.

SessionManager Global variables that are maintained by the operating system, plus subkeys that list applications that do not run well under Windows 98, DLLs whose version numbers should be checked, and directories and file names for all the Session Manager DLLs.

TimeZoneInformation Values for time zone settings, which should be set using the Date/Time option in Control Panel.

Update Value indicating whether Windows 98 was installed over an earlier version of Windows.

VMM32 The file names of VxD files combined into the Vmm32.vxd virtual device driver.

And here is some pertinent information about AUTOEXEC ...

Autoexec.bat Processing

Autoexec.bat is not required for Windows 95 or Windows 98, but it is included for compatibility purposes. If the computer has an Autoexec.bat file, each line is processed in sequence during system startup. Autoexec.bat can contain additional application-specific entries that are run in the sequence they are listed.

Windows 98 passes the initial environment to Command.com with the correct Windows and Windows Command directories already in the path and with the environment variables PROMPT, TMP, and TEMP already set. (TEMP= and TMP= indicate locations for temporary directories; both are specified for compatibility reasons.)

The default Windows 98 environment includes the following:

tmp=c:\windows\temp

temp=c:\windows\temp

prompt=$p$g

path=c:\windows;c:\windows\command

comspec=c:\windows\command\Command.com

Autoexec.bat Changes for Windows 98

Windows 98 Setup makes the following basic changes to Autoexec.bat:

Updates the path= line statement.

Uses rem to comment out incompatible TSRs.

Deletes any win statement (or equivalent) and Share.exe.

Copies the original Autoexec.bat to Autoexec.dos.

Sets the Temp directory.

I hope this looks ok. Right now I am lost trying to format these excerpts. There seem to be unexplained linefeeds and other stuff going on. The worst thing is lack of scroll bars for long excerpts. Doing some testing over in this thread.

Edited by CharlotteTheHarlot
Link to comment
Share on other sites

Export the whole registry and then text search for "temp" WITH quotes but WITHOUT case-sensitivity. Here is what should be found (well, these are only some of the values I have in that key):
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager\Environment]"Path"="C:\\Windows;C:\\Windows\\Command"
"Prompt"="$p$g"
"Temp"="C:\\Temp"
"Tmp"="C:\\Temp"
"WinBootDir"="C:\\Windows"
"WinDir"="C:\\Windows"

Hi CharlotteTheHarlot,

I tried that and my Win98 registry has only 2 instances of "temp" (with quotes):

[HKEY_LOCAL_MACHINE\Software\KasperskyLab\AVP6\environment]

"Temp"="%DataRoot%\\temp"

and

[HKEY_USERS\.DEFAULT\Software\CpuIdle]

"Temp"=dword:00000046

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager\ in my Win98 registry has no string or subkey, whatever, with the name Environment, no idea why your Win98 registry has one.

My specific Msdos.sys loaded at boot time by System Commander contains the following, maybe this has something to do with it:

[Paths]

WinDir=E:\xxxxxx [actual directory name replaced here with xxxxxx for security reasons]

WinBootDir=E:\xxxxxx

HostWinBootDrv=E

[Options]

BootMulti=1

BootGUI=1

DoubleBuffer=1

AutoScan=0

WinVer=4.10.2222

DisableLog=1

Logo=0

A simple experiment is to rename the AUTOEXEC.BAT to something and then reboot. Then, immediately get into a command prompt and type: SET
I have System Commander installed, with about 15 different opsys selections, each containing a configurable set of boot time files. It would be no problem to reboot with an empty autoexec.bat or with an autoexec.bat without the Temp statements, but I am not sure about the usefulness of such an experiment. My system has worked fine for years with the Temp and Tmp entries, and without the environment entry in the registry. Edited by Multibooter
Link to comment
Share on other sites

He's probably ok because AUTOEXEC in this case should be redundant occuring after the registry initialized where the environment strings most likely were set already.. Remember that since Win95 both AUTOEXEC.BAT and CONFIG.SYS have been truly optional (and if you have been at this game since the DOS 2.xx era you will remember just how big a change that was).

Hey, you're right! Just tested it now. I can change the %temp% and %tmp% environment variables in Autoexec.Bat and they stick, however, when I open an archive in TugZip, any files it temporarily extracts end up in %windir%\temp, presumably due to those registry values you indicated.

Anyway, IMHO, all directory removal and *.* deletes should always be spelled out by hand and not automated. But to each his own!

I used to be wary of deleting stuff in %windir%\temp, but have since become more comfortable that unless there's something actively using this directory, it's safe to wipe. Also, if something in there is currently open, you get an "access denied" error when you try to delete it.

I normally just define %TEMP% in Autoexec.Bat, for the benefit of DOS applications that may use it (also for my own benefit, since I often put stuff there too). That leaves the automatically generated %TMP% environment variable pointing the MS-W temporary directory, so I can use this in batch files when required.

Under Win 9x one can set TEMP and TMP from CONFIG.SYS, while under ME that may be done in the registry, if I'm not mistaken (about ME, of 9x I'm sure).

Didn't know that. Another feature copied from DR-DOS 6 (or earlier?) ;)

Joe.

Edited by jds
Link to comment
Share on other sites

Yes, I guess so.

But note that there is a difference.

When you set TEMP, TMP and/or TMPDIR (some old dos programs look for this latter one instead) from CONFIG.SYS, these settings superceed anything present in the registry. When you do it through the registry, these settings still superceed whatever settings are put in the AUTOEXEC.BAT. Settings from AUTOEXEC.BAT will only stick if not set also from the registry or CONFIG.SYS. So, if you don't want to have conflicting locations for the TEMP dir, the best idea is to set those three variables from CONFIG.SYS, so as to ensure they'll be the same in Virtual Machine #1 (where Windows runs) and all subsequent VMs (which are DOS Boxes). And, yes, Win 9x (or DOS 7+) CONFIG.SYS understand the SET command, of course. You can use it even to set the PATH from CONFIG.SYS.

Link to comment
Share on other sites

Under Win 9x one can set TEMP and TMP from CONFIG.SYS, while under ME that may be done in the registry, if I'm not mistaken (about ME, of 9x I'm sure).

I had totally forgotten about that, Dencorso is absolutely correct. Referring to the old Qbasic version of MS-DOS Help ...

The CONFIG.SYS file is a text file that contains special commands. These      _
commands configure your computer's hardware components so that MS-DOS and _
applications can use them. When MS-DOS starts, it carries out the commands _
in the CONFIG.SYS file. Typically, the CONFIG.SYS file is located in the
root directory of drive C. _
_
CONFIG.SYS commands _
_
The following CONFIG.SYS commands can be used only in the CONFIG.SYS file: _
_
<Buffers> <Files> _
<Country> <Install> _
<Device> <Lastdrive> _
<Devicehigh> <Numlock> _
<Dos> <Shell> _
<Drivparm> <Stacks> _
<Fcbs> <Switches> _
_
The following commands are commonly used in the CONFIG.SYS file and can also _
be typed at the command prompt: _
_
<Break> _
<Rem> _
<Set> _
_
The following special CONFIG.SYS commands are used only to define multiple _
configurations within the CONFIG.SYS file: _
_
<Include> _
<Menucolor> _
<Menudefault> _
<Menuitem> _
<Submenu> _

I re-read the section about MSDOS.SYS and must correct what I said above. It is true that it can initialize the environment with PATH strings, however there seems to be no way to influence environment variables, global or otherwise. It would seem that CONFIG.SYS is the earliest vector one can use. From the Win98 Resource Kit (Rk98book.chm) ...

Config.sys Processing

Config.sys defaults are implemented by Io.sys, as described in the previous section. However, Config.sys can contain application-specific entries in addition to information stored in Io.sys. These are processed in the sequence they are listed. After the base Config.sys file has been read, all devices are loaded, and Command.com is started.

Windows 98 loads memory managers supplied by other vendors if they are present in Config.sys; however, some might cause errors. Similarly, Windows 98 allows the use of command shells from other vendors, but there are some differences. For example, long file names are disabled, which might also indicate that other problems could occur using these command shells.

Config.sys Changes for Windows 98

Windows 98 has predefined settings built in for most common Config.sys settings, so Windows 98 Setup removes many of these lines (such as settings for files, buffers, and stacks) if they are equivalent to the default values, by using rem to comment out the line.

Tips for Editing Config.sys in Windows 98

If you edit Config.sys in Windows 98, observe the following basic guidelines:

Do not include the smartdrv command. Windows 98 includes built-in disk caching, and double-buffering is now provided by Dblbuff.sys.

Remove any device=mouse.sys lines or similar lines. Windows 98 includes built-in mouse support.

There used to be this really great explanation of the Win9x startup procedure ... yes! ... it is still online after all these years over at Chris Quirke's Win9x Page. This section used to be required reading:

The Startup Axis

Link to comment
Share on other sites

Also, if something in there [in \Temp\] is currently open, you get an "access denied" error when you try to delete it.
ZoneAlarm v5.5, until I got rid of it, used to place and leave temporary files there. The most current file was then still in use, and I got a msg "Access denied" when trying to delete all Zone Alarm tmp files at the same time, a little nuisance. No idea how cleantmp.exe reacts when it encounteres a file "Access denied".
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...