Use .bat file to automatically login into Particle with CLI

I am trying to automically claim 250 P1’s to my account and I am wondering if a .bat file could do that working with the CLI. I am new to this but as a start it would be below but I am stuck at responding to the “? Please enter your email address” using the bat.

Does anyone know how to repsond to questions using .bat commands?

cmd /c “particle login”

You don’t need to login if you have a particle.config.json file in the .particle folder.
(Do it manually for the first time or on the command line)

WIth that, you can simply do a particle add DEVICE_ID

1 Like

I was hoping to pair the bat with the below and perform some other functions too like:

particle update
paricle flash
then add to my acocunt
and possible automatically pull in the id with the below

cmd /c “dfu-util -d 2b04:d006 -a 1 -s 3618:12 -U device_id && xxd -g 12 device_id”

I would need to particle login cause every time the bat is opened it creates a new session and this bat would automate the entire setup and claiming of the devices

Not sure if i understand what you need.

You just need to login to one account right?

Simply add a particle.config.json file to .particle. or manually login to the particle account once.
This will get you passed the ? Please enter your email address

From then on, all the other commands will not require you to login.

BTW, batch files also feature loops, so only one session shoukd be required.

Another thing is to use < input.txt to feed input commands from a file into a batch

Thanks for the suggestions, but I figured it out as below, I just needed to add the ID and PW and the end of the cmd

cmd /k “particle login” username password

thanks for that hint, helped me setup a TravisCI environment to check my new library :slight_smile:

1 Like