windows - Batch code to temporarily disable mouse input -


i need have batch file starts after program.exe starts temporarily disable mouse input.

this i've come far:

    rem ---------------------------------     rem disable mouse     set key="hkey_local_machine\system\currentcontrolset\services\mouclass"     reg delete %key%     reg add %key% /v start /t reg_dword /d 4     rem --------------------------------- 

suggestions?

@echo off echo "please pull mouse cord out of pc..." <do stuff> echo "please plug mouse cord pc." exit /b 0 

sorry, couldn't resist.

in seriousness though, shouldn't rely on storing registry key in value of batch file. happens if file terminated prematurely? power failure? error in script?

if above in example works (i haven't tried it), @ least use reg export export temporary file, , reg import put back. can delete temp file after successful reg import (make sure check %errorlevel% of reg import, not write command on next line, or @ least link && such reg import %file% && del /q %file%

more on reg command


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -