This promise and the following one contain a lot of duplicated code here. A better practice is to define vars depending on the OS (including a default value), then use just one "commands" promise.