Skip to content

[HowTo] Schedule runs on Windows

Vladimir Budylnikov edited this page Jul 15, 2024 · 5 revisions
  1. Install official git client for Windows and Node.JS any way, you would prefer.

I use Microsoft WinGet:

winget install "git.git" --accept-source-agreements --silent --disable-interactivity
winget install "Node.js" --accept-source-agreements --silent --disable-interactivity
  1. Select the path, you want to store repository and browser data. I select %userprofile%/Documents/Git/, directory Git inside My Documents

  2. Press 🪟Start button. Search for CMD there and run this commands:

    1. Create directories

      mkdir %userprofile%\Documents\Git
      mkdir %userprofile%\Documents\Git\FGC
    2. Download repository

    cd %userprofile%\Documents\Git\FGC
    git clone https://github.com/vogler/free-games-claimer.git
  3. Create script file with name fgc.bat in %userprofile%\Documents\Git\FGC

:: Anything after two colons in line in this files is ignored
:: It is used to explain the script

:: This script runs vogler/free-games-claimer to claim free games from different stores


set SHOW=1 :: Change this to 0, if you want to run silently
:: use `set VARIABLE=VALUE` for other environmental variables if you need

cd %userprofile%\Documents\Git\FGC\free-games-claimer :: This it the directory with actual repository

git checkout . :: decline any changes in repository
git pull :: download latest updates
cmd.exe /c npm install package.json :: install needed node.js packages
cmd.exe /c npx playwright install
timeout 360 

:: starting the first calim task for user `username1`
echo "username1 epic-games" 
set BROWSER_DIR=data/username1 :: select relative directory for user data
cmd.exe /c node epic-games.js :: `cmd.exe /c command` is needed to proceed script in case of errors

:: finishing the first calim task for user `username1`

timeout 360

:: starting the second calim task for user `username2`
echo "username2 epic-games"
set BROWSER_DIR=data/username2
cmd.exe /c node gog.js
timeout 360

Change username1, username2 in echo for better logs You can add as many accounts as you want here, copying last lines in this script

  1. Press 🪟Start button. Search for Task Scheduler

  2. Press Create Basic Task... on the right panel

    • Name: _Free-Games-Claimer
    • Trigger: Daily
    • Start: 05:00:00 (or any time you are comfortable to run this script automatically)
    • Action: Start program
    • Program/Script: %userprofile%\Documents\Git\FGC\fgc.bat
  3. Now you can see created task in the scheduler list. Right click on it, Run to check.

Clone this wiki locally