Computing.Net > Forums > Windows 95/98 > Batch file help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file help

Reply to Message Icon

Name: Dix
Date: December 19, 2004 at 23:57:16 Pacific
OS: 98SE
CPU/Ram: 1.4GhzCeleron/512MB
Comment:

I've got a small batch file I use to "cleanup" every time the machine starts. But, for some reason on this particular machine it doesn't work... for example the following line(s) all return a "bad command or filename" error.

DELTREE /y C:\WINDOWS\TEMP\

On another machine (win95B) it works fine... any clues?



Sponsored Link
Ads by Google

Response Number 1
Name: DAVEINCAPS
Date: December 20, 2004 at 00:27:05 Pacific
Reply:

Bad command or file name means the command isn't in the current directory or in a directory listed in the path statement. Deltree is in the windows\command directory which is part of the default windows path. Either deltree isn't in windows\command or the default path has been changed.

But whatever the reason, you can copy deltree.exe to the root directory c:\ and it'll run then.


0

Response Number 2
Name: DAVEINCAPS
Date: December 20, 2004 at 00:29:42 Pacific
Reply:

I assumed you had the command in autoexec.bat which is in the root directory. If your batch file is somewhere else you'd need to copy deltree to whatever directory it's in.


0

Response Number 3
Name: Dan Penny
Date: December 20, 2004 at 04:10:28 Pacific
Reply:

There's an old caveat about deleting your temp files on each bootup. Some/many software installations use the temp directory to dump installation files into. Then it's the "You must restart your computer to finish the installation....." This is where those files come into play. If the contents of the temp directory is deleted (through dos before windows loads), the installation cannot continue.

You would be better off to make a seperate batch file which can be "called" with the choice command from within autoexec.bat.


0

Response Number 4
Name: Derek
Date: December 20, 2004 at 15:59:32 Pacific
Reply:

Take out the final backslash in your batch file line. This should fix the bad command error.

Whether the idea is good is a matter of conjecture. I "think" the temp file will be remade on booting but I am not certain. Others might know for certain.

Derek.W


0

Response Number 5
Name: WhitPhil
Date: December 20, 2004 at 18:02:58 Pacific
Reply:

The final \ is ok. I believe what that will do is delete all files and directories, but will leave the TEMP folder intact.
If you leave the backslash off, everything is deleted including the folder.

If you still want to do this, even after Dan's advice, replace your command by

C:\Windows\Command\DELTREE /y C:\WINDOWS\TEMP\

Ie: Use the fully qualified name of the command



0

Related Posts

See More



Response Number 6
Name: Derek
Date: December 20, 2004 at 18:30:46 Pacific
Reply:

Hi Whitphil

I felt sure I'd got bad command after using final forward slash when I tested it out on a similar issue recently, hence my confidence. I did assume the poster wanted to delete the temp folder itself.

I will obviously fiddle about with this in order to complete my education but I know you far too well to be wrong.

Thanks for the correction therefore. Apologies to the poster for my mis-information - something I try hard to avoid.

Derek.W


0

Response Number 7
Name: Dan Penny
Date: December 20, 2004 at 18:37:07 Pacific
Reply:

WhitPhil is correct re; the parameters he outlined. If the backslash is left off the folder and everything below that is deleted, and the Windows registry will re-create the (empty) directory on the next boot, just like the recycle bin, applog, etc. (It's one of the "main established" folders of windows.)

"Use the fully qualified name of the command"

Ah, of the "old school". ;>) (That's the way I was taught, always provide the full path/command.)


0

Response Number 8
Name: Derek
Date: December 20, 2004 at 18:38:13 Pacific
Reply:

Yep, tried it. Must have done some other typo last time - blushing suitably.

Derek.W


0

Response Number 9
Name: Tryan
Date: December 20, 2004 at 18:40:47 Pacific
Reply:

Where can I read more about response number 3.
I wrote a "clean.bat" and stuck it in my autoexec too and have not had any trouble with installations involving rebooting - I'd like to perhaps test this out by installing something that does require the reboot and uses the temp folder.

If it really does prevent completion of installation I'd like to make appropriate changes.



0

Response Number 10
Name: Derek
Date: December 20, 2004 at 18:40:48 Pacific
Reply:

Thx Dan

Derek.W


0

Response Number 11
Name: melee5
Date: December 21, 2004 at 21:55:20 Pacific
Reply:

Just an aside here. Windows\TEMP folder is rebuilt in 98 by io.sys, not by Windows. 95 won't rebuild it all, just an odd feature of 98?

Tryan - it really does put the clobber on SOME installations, don't go there. Better solution is to run the batch weekly in preparation for defrag session or some such. And that would be AFTER getting into Windows at which time the installation files would have had their chance to install. Temp folder files don't build up so fast that a weekly run wouldn't take care of it.

Far more important is to keep on top of Temporary Internet Files as they can get out of hand in three days or so, don't use a batch file daily here either as they can't work properly, only use the Internet Options box if you want to do it the right way. Don't get me wrong, tweaking is OK but both these batch solutions are really over the edge. I been there and I done that and it's just no good.


0

Response Number 12
Name: Dan Penny
Date: December 22, 2004 at 05:32:51 Pacific
Reply:

"Windows\TEMP folder is rebuilt in 98 by io.sys, not by Windows."

Hmmm. I think you're wrong about that. I'll have to do an experiment and post back.

"...don't use a batch file daily here either as they can't work properly,.."

I use a batch file I wrote on the TIF's (among other things) and it works just fine.
It's on my webspace as well as Mesich's site (Mesich.com) under Freeware I believe. (Purge.zip)


0

Response Number 13
Name: Dan Penny
Date: December 22, 2004 at 05:43:41 Pacific
Reply:

melee5, you're quite correct about io.sys "rebuilding" the c:\windows\temp directory. I stand corrected. Thank You. (I'll go stand in the corner for five minutes.) ;>)


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows 95/98 Forum Home


Sponsored links

Ads by Google


Results for: Batch file help

Batch File help! www.computing.net/answers/windows-95/batch-file-help/132038.html

batch file help? www.computing.net/answers/windows-95/batch-file-help/86257.html

Batch file for two different OS's www.computing.net/answers/windows-95/batch-file-for-two-different-oss/126507.html