• Loading
    • How To Keep A System Open For Long Duration Using Batch Script

      Introduction
      This article is very useful in order to keep your system open/unlocked for long duration.
      Sometime in some of projects/process(more specific at the time of any Training or meeting) it is required to keep the system open for long duration, for those scenarios if an user want to take a break then it’s not possible for him/her to leave their system because the process is still running , and it might will get stopped or end if the system gets locked.
      And to avoid this kind of scenarios we need a program that will keep our system busy for long time or interrupt it before every three minutes.

      Description
      This batch file will keep your system open for a long duration. And a user can go for a break whenever he/she wants.
      More specific, this script will press “Num Lock” in every 2 minutes and will keep your system busy. Just follow below mentioned steps.

      Procedure
      We need to do only two minor jobs in order to achieve this goal.
      1. Create a .vbs file (eg: keyboard.vbs) in C drive
      2. Create a batch file to call .vbs file

      Steps
      1) Open a notepad (Run---->notepad or click right button of your mouse---->new---->text document)
      Attachment 320

      2) Copy the below mentioned script in notepad

      Code:
      Set WSHShell = WScript.CreatObject("WScript.Shell")
      WSHShell.sendkeys"{NUMLOCK}"
      WSHShell.sendkeys"{NUMLOCK}"
      Attachment 321
      3) Save this file with .vbs extn (eg: keypress.vbs) in C drive.
      4) Open another notepad and paste the following scripts in it.

      Code:
      @echo off
      rem ===== this scrip will not let your system locked for a period defined by you =====
      
      
      echo Set WSHShell = WScript.CreatObject("WScript.Shell") >>C:\keypress.vbs
      echo WSHShell.sendkeys"{NUMLOCK}" >>C:\keypress.vbs
      echo WSHShell.sendkeys"{NUMLOCK}" >>C:\keypress.vbs
      
      echo.
      echo Enter following details
      echo.
      echo.
      echo Enter Task Name   = keepopen
      echo.
      echo.
      echo Enter start timing in this format      HH:MM:SS   (10:02:00)
      echo.
      echo.
      echo Enter Start Date in this format        MM/DD/YYY  (08/03/2010)
      echo.
      echo.
      echo Enter End Date in this format        MM/DD/YYY  (08/05/2010)    
      echo.
      echo.
      echo Enter Your system login             System_login(EIN / empid / whatever it is)    
      echo.
      echo.
      echo Enter your System  Password            System password
      
      
      rem ---   make a .vbs file named keypress.vbs write the below mention scripts and save it in C drive
      
      rem  -- Set WSHShell = WScript.CreatObject("WScript.Shell") >>C:\keypress.vbs
      rem -- WSHShell.sendkeys"{NUMLOCK}" >>C:\keypress.vbs
      rem -- WSHShell.sendkeys"{NUMLOCK}" >>C:\keypress.vbs
      
      
      
      echo.
      echo.
      echo.
      
      set /p nolock=enter task name        :
      set /p start=enter start time        :
      set /p Sdate=enter start date       :
      set /p Edate=enter end date          :
      set /p LOGIN=enter SystemLogin       :
      set /p Password= enter SystemPassword   :
      
      cd\
      SCHTASKS /Create /SC MINUTE /MO 2 /TN %nolock% /TR C:\keypress.vbs /ST %start%  /SD %Sdate% /ED %Edate% /RU SID\%LOGIN% /RP %Password%
      5) Save this text file with .bat extn (eg: NoLock.bat) anywhere in your machine.
      6) Run this bat file (double click) , It will prompt for some fields
      Attachment 322

      Task Name would be anything (depends upon you eg: test / lock / …)


      Start timing: Its start time for this process
      Start Date : From which day you want to keep your system not to be locked
      End Date : Till when you want your system to be unlocked
      Your Login : It’s your System login Id
      Your Password : It’s your system login Password

      Attachment 323

      Attachment 324

      Press enter


      7) Automatic run

      This will automatically start working from 18th of Feb 2011 at 10.am and will be end on 19th of Feb.
      One can see its log in, Control Panel---->Scheduled Tasks ( task name)

      Attachment 325

      Deleting the Task
      One can delete this process anytime form Start---->control Panel---->scheduler Task---->(taskname)

      Attachment 326

      Attachment
      This batch file is an example of the same process, if you will double click this file you will able to how it works. (Before running this file please rename it to remove the .txt)
      Attachment 327
    • Currently Active UsersCurrently Active Users

      There are currently 73 users online. 2 members and 71 guests

      Most users ever online was 323, 11-23-2011 at 07:47 AM.

      1. snehil2529,
      2. vbairmaclsho