PDA

View Full Version : Windows 98 / DOS MAster needed... Norm?



Joe
01-31-02, 06:37 PM
Not sure where to put this so Ill try here...

Is there a dos command that can kill a process running in the background under win 9x?

I want this to all be done through a batch file etc... It is a small program for a friend but you need to kill a certain process before executing the app or it wont work... And Im not about to explain how to do this under win 9x so im gonna attempt a batch file for simplicity.

Any help appreciated! :)

Joe

Norm
01-31-02, 07:16 PM
Funny you should ask that question Ping, I'll bet everyone that's into writing batch files sooner or later wants to kill a process in windows. I have asked that question on many forums, SG included, and have never got an affirmative answer myself. In NT I believe there's a kill command, but to my knowledge, after searching and asking for quite some time, is it can't be done in 98.

I'm not saying it absolutely can't be done, there may be ways of calling other small scripts in machine code,. or vb.
I haven't got to that stage yet.

I'm hoping there is an answer too. I'd like to write some myself.

Joe
01-31-02, 08:22 PM
Wait... Do you think you could make a script that deletes a reg key and then reboots? is that possible?

Norm
02-01-02, 10:31 AM
Yes, you can delete a key and reboot. I hadn't done it for a long time, so I had to readup and check some of my earlier batch files, and do some testing.

Here's what works.....

Method#1 - While in Windows you need to use method#1
I'll give examples to help you.
For testing purposes I created a Key at HKEY_LOCAL_MACHINE and called it norm (hehe) and then used both methods to delete it. You will have to edit these examples to suit your needs.

In windows, you need to make a reg file with the key you want to delete, and call the reg from your batch file.

First, make a reg file (notice the - sign before the key path, it will delete the key. If you ommit this - sign, it will create the key instead. I named my reg file n.reg

eg:

REGEDIT4

[-HKEY_LOCAL_MACHINE\norm]

Save it and remember the path, I saved mine to the desktop for testing.

Then in your batch file you use regedit to call the reg file
eg:

REGEDIT c:\windows\desktop\n.reg


Method#2 - From Dos Real Mode (eg: from autoexec.bat, or a call to another batch file from within autoexec.bat, or the command prompt) ADD the following line (Your path will be different)

eg:

REGEDIT /d HKEY_LOCAL_MACHINE\norm

Notice that when using Real Mode, you need the /d instead of the - sign to delete a key

Both of these methods are tried and tested by myself, on a Win98 machine. Actually I retested them this morning to be sure.


To reboot Win98 from a batch file use the following line

START %windir%\RUNDLL32.EXE %windir%\SYSTEM\shell32.dll,SHExitWindowsEx 6

Have fun Ping, that's the main thing, right? :)

el bob
02-03-02, 03:10 PM
Originally posted by Norm
Yes, you can delete a key and reboot. I hadn't done it for a long time, so I had to readup and check some of my earlier batch files, and do some testing.

Here's what works.....

Method#1 - While in Windows you need to use method#1
I'll give examples to help you.
For testing purposes I created a Key at HKEY_LOCAL_MACHINE and called it norm (hehe) and then used both methods to delete it. You will have to edit these examples to suit your needs.

In windows, you need to make a reg file with the key you want to delete, and call the reg from your batch file.

First, make a reg file (notice the - sign before the key path, it will delete the key. If you ommit this - sign, it will create the key instead. I named my reg file n.reg

eg:

REGEDIT4

[-HKEY_LOCAL_MACHINE\norm]

Save it and remember the path, I saved mine to the desktop for testing.

Then in your batch file you use regedit to call the reg file
eg:

REGEDIT c:\windows\desktop\n.reg


Method#2 - From Dos Real Mode (eg: from autoexec.bat, or a call to another batch file from within autoexec.bat, or the command prompt) ADD the following line (Your path will be different)

eg:

REGEDIT /d HKEY_LOCAL_MACHINE\norm

Notice that when using Real Mode, you need the /d instead of the - sign to delete a key

Both of these methods are tried and tested by myself, on a Win98 machine. Actually I retested them this morning to be sure.


To reboot Win98 from a batch file use the following line

START %windir%\RUNDLL32.EXE %windir%\SYSTEM\shell32.dll,SHExitWindowsEx 6

Have fun Ping, that's the main thing, right? :)

the work of true dos master. good stuff norm.