I would like to ask the Node program, how to modify the PATH variable of Windows ah? Add a variable.

specifically refers to Electron applications, but if Node can do it, it"s the same.
We have some exe files to use in the program, so we need to make sure that the environment variables are normal when the program starts, and then run these command as CMD.
are these values:

what I"m sure is that programs written in other languages can be done, but I don"t know if they can be written based on Node and how to do them.
does anyone know what to do?
Thank you.

Mar.12,2021

child_process.exec can execute instructions. But I don't know the specific instructions of windows .

official website


you can set environment variables when you start the process.


the problem has been solved. You can directly modify the value of process.env.PATH, which is valid during the startup of the program

.
Menu