Influxdb CLI differences between 1.8 to 2.3

Hi,
I have code to query data using CLI version 1.8.
now we upgrade to version 2.3, and the calls doesn’t work. I saw the syntax has changed dramatically, but wonder if there is some backward compatibility.

the call in version 1.8 is as follows (bat file):

SET start=%1
SET end=%2

cd “C:\Program Files\InfluxDB”
influx.exe -execute “use telegraf”
influx -database “telegraf” -execute “select mean(*) from win_cpu where time > ‘%start%’ AND time < ‘%end%’”

please let me know how to run this call in version 2.3.
thx in advance

@Y_BB,
Welcome!!!
Hello yes there is backward compatibility with InfluxQL:

However I recommend just using flux the equivalent query would be:

from(bucket: "telegraf")
    |> range(start: <your start time e.g. 2022-08-01T12:00:00>, stop: <your stop>)
    |> filter(fn: (r) => r._measurement == "win_cpu")
    |> mean()
    |> yield(name: "_results")

I highly encourage you to read the following blog: