Batch Script to Toggle Numlock?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Batch Script to Toggle Numlock?

#1 Post by Dos_Probie » 05 Jun 2012 17:52

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

Fawers
Posts: 187
Joined: 08 Apr 2012 17:11
Contact:

Re: Batch Script to Toggle Numlock?

#2 Post by Fawers » 05 Jun 2012 18:41

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.

Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: Batch Script to Toggle Numlock?

#3 Post by Dos_Probie » 05 Jun 2012 19:09

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...

Fawers
Posts: 187
Joined: 08 Apr 2012 17:11
Contact:

Re: Batch Script to Toggle Numlock?

#4 Post by Fawers » 05 Jun 2012 21:17

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.

Squashman
Expert
Posts: 4472
Joined: 23 Dec 2011 13:59

Re: Batch Script to Toggle Numlock?

#5 Post by Squashman » 06 Jun 2012 05:42

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.

Post Reply