Welcome to WinForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Disable and enable keyboard & mouse from batfiles?

 
   Windows XP Arc2 (Home) -> Help & Support (archive) RSS
Next:  "Open With" window  
Author Message




User: inactive
Posts:



(Msg. 1) Posted: Sun May 28, 2006 12:47 pm
Post subject: Disable and enable keyboard & mouse from batfiles?

Hi

I'm looking for a way to disable and enable the keyboard and mouse from batchfiles.

The reason being that sometimes I set up my computer to perform maintenance tasks, downloads and recordings using a timer program.

Unfortunately I have two kids and a wife who have a habit of using the computer. It doesn't matter how many times I ask them not to use the computer at particular times I come back from work or a business trip to find that the timers failed because some one closed my software, ran other software or switched off the computer.

(Before anybody comments, there is another similar computer in the house with a similar software setup and broadband internet access)

I saw a posting on a web site which said that the following can disable the keyboard and mouse under Windows 98:

cd c:\windows
rundll32.exe mouse,disable
rundll32.exe keyboard,disable

However I run Windows XP Home SP2

Is there an equivalent to the above which will run under XP?

I would like to be able to create 4 batchfiles

Disable-keyboard.bat
Enable-keyboard.bat
Disable-mouse.bat
Enable-mouse.bat

That way I can disable input when my programmes need to run and reenable it afterwards

As an alternative to the above, are there any command line utilities which will do the same thing?

Any suggestions

 >> Stay informed about: Disable and enable keyboard & mouse from batfiles? 
Back to top
Login to vote
Sparda




Joined: Jun 27, 2005
Posts: 1983



(Msg. 2) Posted: Sun May 28, 2006 1:56 pm
Post subject: Re: Disable and enable keyboard & mouse from batfiles? [Login to view extended thread Info.]

I don't know if you will beable to do this your self (it would be nice if you could, since i don't know right now but i can work it out). There is a command line untility for device managment (http://support.microsoft.com/?kbid=311272 (DevCon)) it will alow you to do what you wish to do, but you have to ficure out what your mouse and keyboard ID is. Then you can just run
Code:
devcon disable <id>
to disable the mouse and agian for the keyboard.

 >> Stay informed about: Disable and enable keyboard &amp; mouse from batfiles? 
Back to top
Login to vote
Sparda




Joined: Jun 27, 2005
Posts: 1983



(Msg. 3) Posted: Sun May 28, 2006 2:21 pm
Post subject: Re: Disable and enable keyboard & mouse from batfiles? [Login to view extended thread Info.]

I'v worked it out (a bit more).

To find out what your mouses ID is you must do this:
Code:
devcon find * > C:\devcon.txt
This will output the console in to devcon.txt directly in C:\. Open that in your favorit text editor and search for the word mouse. This will give your your mouses ID (mine is HID\VID_046D&PID_C01D\6&14C4188C&0&0000). Now, you would have thought that you would simply do
Code:
devcon disable HID\VID_046D&PID_C01D\6&14C4188C&0&0000
wouldn't you? But of course nothing is ever that simple with windows. All thoughs &s in the devices ID makes the console think you want to execute another command, which of course we don't want to do, and putting "" around the ID doesn't help either becasue then it can't find the ID.

So, what must be done now is to take all ID of the mouse but stop befor the first & (in my case this is HID\VID_046D) and then do:
Code:
devcon fine <ID of mouse befor the first &>*
(In my case that would be HID\VID_046D*) Now, if only the mouse is listed that means it is safe to disable in this fashin.

Now we are going to disable the device like so:
Code:
devcon disable <ID of mouse befor the first &>*
(In my case that would be HID\VID_046D*) You should now find your mouse has stopped working. Just run
Code:
devcon enable <ID of mouse befor the first &>*
to enable it again. Then do this all again for the keyboard, but beware, there might be more then one device with the word keyboard in it's name, be sure you device is called "Standard 101/102-Key or Microsoft Natural PS/2 Keyboard" or some thing similare.
 >> Stay informed about: Disable and enable keyboard &amp; mouse from batfiles? 
Back to top
Login to vote




User: inactive
Posts:



(Msg. 4) Posted: Sun May 28, 2006 3:45 pm
Post subject: Re: Disable and enable keyboard & mouse from batfiles? [Login to view extended thread Info.]

Hi Sparda,

Thanks for all of the instructions - I'll give it a try.

Cheers

Tony
 >> Stay informed about: Disable and enable keyboard &amp; mouse from batfiles? 
Back to top
Login to vote




User: inactive
Posts:



(Msg. 5) Posted: Tue May 30, 2006 6:29 am
Post subject: Re: Disable and enable keyboard & mouse from batfiles? [Login to view extended thread Info.]

Hi Sparda,

It's not quite working yet.

I downloaded devcon (looks like a powerful tool) and ran

devcon find * > C:\devcon.txt

The resulting text file only had one entry each for keyboard and mouse

ACPI\PNP0F13\4&1B5998F7&0 : PS/2 Compatible Mouse
ACPI\PNP0303\4&1B5998F7&0 : Standard 101/102-Key or Microsoft Natural PS/2 Keyboard

However when I try to list just the mouse it finds nothing

devcon fine <ID of mouse before the first &>* (presumably you meant find not fine)

devcon find ACPI\PNP0F13\4* > c:\mouseID.txt

A similar thing happens when I try to find the keyboard.

I'm a bit reluctant to go on to the next stage of trying to disable the mouse or keyboard if it's not finding them correctly.

Any suggestions?

Also, what happens when I reboot from a system where the mouse and/or the keyboard are disabled?
Do they automatically reenable on a reboot or will the rebooted system still have them disabled.
My concern is that the computer will lock up for some reason, the enable command won't be issued and it will be difficult to get back into the system.

Cheers

Tony
 >> Stay informed about: Disable and enable keyboard &amp; mouse from batfiles? 
Back to top
Login to vote
Sparda




Joined: Jun 27, 2005
Posts: 1983



(Msg. 6) Posted: Tue May 30, 2006 7:00 am
Post subject: Re: Disable and enable keyboard & mouse from batfiles? [Login to view extended thread Info.]

Try
Code:
devcon find *ACPI\PNP0F13\4*
insted...

Just to clear a few things up, if the keyboard and mouse are disable and some one forcifvly restarts the computer there is no way to renable them short of getting another USB keyboard and pluging it in. This could of course be avoided by having a script that runs on startup that enables the keyboard and mouse (reguradless of there last state)
 >> Stay informed about: Disable and enable keyboard &amp; mouse from batfiles? 
Back to top
Login to vote




User: inactive
Posts:



(Msg. 7) Posted: Sun Jun 04, 2006 2:45 pm
Post subject: Re: Disable and enable keyboard & mouse from batfiles? [Login to view extended thread Info.]

Hello again,

I tried your suggestion

C:\devcon\devcon find *ACPI\PNP0F13\4* > c:\devcon\mouse.txt

but the resulting text file only contains the following:

No matching devices found.
 >> Stay informed about: Disable and enable keyboard &amp; mouse from batfiles? 
Back to top
Login to vote
Sparda




Joined: Jun 27, 2005
Posts: 1983



(Msg. 8) Posted: Mon Jun 05, 2006 3:52 am
Post subject: Re: Disable and enable keyboard & mouse from batfiles? [Login to view extended thread Info.]

try
Code:
devcon find ACPI*
and see what the result is...
 >> Stay informed about: Disable and enable keyboard &amp; mouse from batfiles? 
Back to top
Login to vote




User: inactive
Posts:



(Msg. 9) Posted: Tue Jun 06, 2006 7:03 pm
Post subject: Re: Disable and enable keyboard & mouse from batfiles? [Login to view extended thread Info.]

Hi again

The result was

ACPI\FIXEDBUTTON\2&DABA3FF&0 : ACPI Fixed Feature Button
ACPI\GENUINEINTEL_-_X86_FAMILY_15_MODEL_3\_0 : Intel(R) Pentium(R) 4 CPU 3.20GHz
ACPI\GENUINEINTEL_-_X86_FAMILY_15_MODEL_3\_1 : Intel(R) Pentium(R) 4 CPU 3.20GHz
ACPI\PNP0000\4&1B5998F7&0 : Programmable interrupt controller
ACPI\PNP0100\4&1B5998F7&0 : System timer
ACPI\PNP0200\4&1B5998F7&0 : Direct memory access controller
ACPI\PNP0303\4&1B5998F7&0 : Standard 101/102-Key or Microsoft Natural PS/2 Keyboard
ACPI\PNP0401\4&1B5998F7&0 : ECP Printer Port (LPT1)
ACPI\PNP0501\1 : Communications Port (COM1)
ACPI\PNP0700\4&1B5998F7&0 : Standard floppy disk controller
ACPI\PNP0800\4&1B5998F7&0 : System speaker
ACPI\PNP0A03\2&DABA3FF&0 : PCI bus
ACPI\PNP0B00\4&1B5998F7&0 : System CMOS/real time clock
ACPI\PNP0C01\2&DABA3FF&0 : System board
ACPI\PNP0C02\1 : Motherboard resources
ACPI\PNP0C02\3 : Motherboard resources
ACPI\PNP0C02\4 : Motherboard resources
ACPI\PNP0C02\5 : Motherboard resources
ACPI\PNP0C04\4&1B5998F7&0 : Numeric data processor
ACPI\PNP0C0C\2&DABA3FF&0 : ACPI Power Button
ACPI\PNP0F13\4&1B5998F7&0 : PS/2 Compatible Mouse
ACPI\PNPB02F\4&1B5998F7&0 : Standard Game Port
ACPI_HAL\PNP0C08\0 : Microsoft ACPI-Compliant System
ROOT\ACPI_HAL\0000 : ACPI Multiprocessor PC
24 matching device(s) found.
 >> Stay informed about: Disable and enable keyboard &amp; mouse from batfiles? 
Back to top
Login to vote
Sparda




Joined: Jun 27, 2005
Posts: 1983



(Msg. 10) Posted: Tue Jun 06, 2006 7:08 pm
Post subject: Re: Disable and enable keyboard & mouse from batfiles? [Login to view extended thread Info.]

ok based on thoughs results
Code:
devcon find *PNP0F13*
should only return the mouse. If so, continue...
 >> Stay informed about: Disable and enable keyboard &amp; mouse from batfiles? 
Back to top
Login to vote
Display posts from previous:   
   Windows XP Arc2 (Home) -> Help & Support (archive) All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows XP
 Windows Vista!
 Win 2000/NT/98/ME


[ Contact us | Terms of Service/Privacy Policy ]