lolo5.net

Get path of default startup directory Win10 (CMD/NodeJs)

5/7/2020
All Articles

In CMD simply make use of the APPDATA environment variable and add "\Microsoft\Windows\Start Menu\Programs\Startup". It will look like this: "%appdata%\Microsoft\Windows\Start Menu\Programs\Startup".

If you want to use the same stragtegy in NodeJS use "proccess.env.appdata" to retrieve the environment variable. Now escape the 's by adding another \ to each of them. Your result will look like this: process.env.appdata+"\Microsoft\Windows\Start Menu\Programs\Startup\".

There you go, you can now access the startup directory from CMD and NodeJS.