Page 1 of 1

Batch Script to Toggle Numlock?

Posted: 05 Jun 2012 17:52
by Dos_Probie
This is in response to my earlier post..
After some digging around I found a backdoor way.
Maybe this will help someone else ... 8)


:ToggleNumlock.cmd
:==================+
@echo off
setlocal
set _prompt=%1

:: Create the VBS script with an echo statement and chain with colon:
echo set WshShell = CreateObject("WScript.Shell") : WshShell.SendKeys "{numlock}">%Temp%\Numlock.vbs

:: Runs the vbScript:
FOR /f "delims=/" %%G IN ('cscript //nologo %Temp%\Numlock.vbs') DO set _string=%%G

:: Delete vbScript:
del %Temp%\Numlock.vbs

Re: Batch Script to Toggle Numlock?

Posted: 05 Jun 2012 18:41
by Fawers
You can then save this .vbs file so you don't have to create it whenever you run numlock.cmd.

By the way, I think you should have posted this on your original thread.

Re: Batch Script to Toggle Numlock?

Posted: 05 Jun 2012 19:09
by Dos_Probie
BTW Fawers, I did consider posting on orginal post but after so many overwhelming responses I decided to repost.
So I quess you never read my orginal post or just didn't know the answer...

Re: Batch Script to Toggle Numlock?

Posted: 05 Jun 2012 21:17
by Fawers
You're right. After so many replies, it sure is better to create a whole new thread so it can gather more and more replies.
I am so sorry for my naiveness.

Re: Batch Script to Toggle Numlock?

Posted: 06 Jun 2012 05:42
by Squashman
Dos_Probie wrote:BTW Fawers, I did consider posting on orginal post but after so many overwhelming responses I decided to repost.

Surely you can't be serious.