Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to detect WIN98 running via DOS batch file? 1

Status
Not open for further replies.

hotfusion

Technical User
Jan 20, 2001
755
GB
As this relates to WIN98SE, I'm hoping this is the correct place.......

I use a simple batch file to keep certain junk files generated by certain software under control on the computers I supervise. It has become apparent that people are being lazy and executing the batch files from within Windows rather than in pure DOS, in which case not all the files would be deleted if they were still in use.

I would like to be able to detect, from DOS, if Windows is running, so that I can cause a suitable message to be displayed under these circumstances.

Is this possible - are there any DOS tricks which could be used to detect if Windows is running, and if so, how I could obtain a suitable error level from this.
Many thanks for any help.
Andy.

Regards, Andy.
**************************************
My pathetic attempts at learning HTML can be laughed at here:
 
A couple questions... You want to know if Windows is running. If Windows isn't running, is the PC simply running DOS? And, is there a specific file that won't be deleted when windows is running? I assume it is in use while Windows is running and that's why it can't be deleted?
 
Thanks for you replies, guys.
mpnut:
There are several files I wish to clear out using this batch file, including, amongst many others the usual accumulated temporary internet files and the associated index.dat, which continues to grow and isn't removed using normal methods.
Your reply led me to the rather stupidly simple method of attempting to delete such a file, then detecting whether it still exists - if running in Windows it will exist, if in DOS it won't.
I might try this method - it might be one way of doing it.

jimp56:
I've just looked at that batch file, and it might well do the trick. so thanks for that. I'll modify it as necessary and give it a try.
Andy.

Regards, Andy.
**************************************
My pathetic attempts at learning HTML can be laughed at here:
 
As a follow-up, the method used in the batch file detects Win98 running perfectly, which is exactly what I needed!
Many thanks.

Regards, Andy.
**************************************
My pathetic attempts at learning HTML can be laughed at here:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top