-3

I'm making a toolset, made entirely with batch files, added to PATH for everyday use. the problem is, i need a way to somehow look for a update when the computer starts, cloning the repo with the last version. the path for the app is C:\Program Files (x86)\EnhancedCMD
and also, the content of the folder is a bunch of .bat files.

i tried to create a batch file with

cd C:\Program Files (x86)\
git clone https://github.com/ItsDoomOne/EnhancedCMD

and saved in the startup folder. it cant overwrite the folder. help pls

1 Answers1

1

On Windows you can schedule tasks using the Task Scheduler, this tasks can be triggered by different events, like logging in, on Windows start, on a date, at a specific time, etc.

You can write a script that checks if the repo exists in disk by checking if the directory exist, if the repo doesn't exist then git clone it, then cd to the repo and call git pull which will update the repository with the latest changes.

try with

if exist "C:/Program Files (x86)/EnhancedCMD" (
  echo updating
  cd "C:/Program Files (x86)/EnhancedCMD"
  git pull
) else (
  echo creating
  cd "C:/Program Files (x86)/" 
  git clone https://github.com/ItsDoomOne/EnhancedCMD.git
)

and save to a file then use the task scheduler to run this file on any event you'd like and make sure to run as administrator, git pull will work assuming that the repository has a default upstream so you don't have to specify a remote repo and a branch