How to Keep Track of When You Work Using a Scheduled Task

During the day, I work as a web developer. To get paid, I need to complete a timesheet. A few weeks, I’ll come Friday and realize, “Hey! I forgot to fill out my timesheet and I can’t remember how many hours I worked this week!.” I’m sure office workers like me can relate to this situation. ????

In this tutorial, I will show you how I solved this problem, by creating a scheduled task that will record the date and time when I log in or lock my computer. This could help anyone, including those who work from home (like the editor of this website), to accurately track how much time they spend sitting in front of the computer each day. The trick is window only.

Part One: Creating a Script

Step 1. Create a folder.

Create login directory

Step 2. Create a new text file in that folder and name it login.bat.

To do this, create a space in the folder and choose New -> Text Document.

Create a new text document

Name it login.bat. (Make sure it’s not named login.bat.txt)

Rename To Login Dot Bat

Step 3. Open the text file and copy and paste the following code into it.

@echo offset datecode=%date:~-4%-%date:~7.2%-%date:~4.2% %time:~0.2%:%time:~3.2%:%time:~6.2%if “%1″==”i” echo %datecode% – Logged in >> C:\!Scripts\Login\login.txtif “%1″==”o” echo Computer %datecode%

Save it!

Important Note: If you want your log file to appear somewhere other than mine, make sure you update the path in the script.

Part two: Create a login task

Step 1. Open the Task Scheduler, by going to Start -> Run (WIN + R) and typing taskchd.msc in the prompt that appears.

See more:  Who is Anatoly Powerlifter (Vladimir Shmondenko)?

Open Task Scheduler

Step 2. Select Create task… from the actions on the right hand side.

Create quests

Step 3. Enter the task name like Login date and time login.

Enter the login task name

Step 4. Click the Triggers tab and add a new trigger. Select:

  • Start of the quest: At login
  • Specific users: This should be your Windows account

Activate upon login

Click OK to add the trigger.

Step 5. Add another trigger except this time select Start Task: Unlock Workstation.

Activate upon unlock

Click OK to add the trigger.

Step 6. Click the Actions tab. Add a new action and point it to your login script with the i argument.

More login action

Click OK to add the action.

Step 7. (Optional – Required only if you are using a laptop) Click the Conditions tab and uncheck the box that says Start the task only if the computer is on AC power.

Set power options

Click OK to create the task.

Third part: Create a key task

Step 1. In Task Scheduler, select Create task… from the tasks on the right hand side.

Create quests

Step 2. Enter the task name like Log in date and time lock.

Create key task name

Step 3. Click the Triggers tab and add a new trigger. Select:

  • Start of the mission: When locking the workstation
  • Specific users: This should be your Windows account

Activate when locked

Click OK to add the trigger.

Step 4. Click the Actions tab. Add a new action and point it to your login script with the o argument.

Add lock action

Click OK to add the action.

Step 5. (Optional – Required only if you are using a laptop) Click the Conditions tab and uncheck the box that says Start the task only if the computer is on AC power.

See more:  How to get Shellac in Skull and Bones

Set power options

Click OK to create the task.

Part Four: Check if everything is working as expected

Your work is now complete. You just need to check that everything is working as expected. Just lock your computer by pressing WIN+L and log back in. If you followed the instructions correctly, you should now have a file named login.txt in the same directory as your script. This file will contain a log of each time you log in and out of your computer.

Log file

Finally, if you want to be able to access this log file quickly, you can follow our guide on how to use keywords to launch almost anything quickly in Windows.

Categories: How to
Source: thpttranhungdao.edu.vn/en/

Rate this post

Leave a Comment