But, in some cases, I want to run a set of commands, but I don't want it to be in the 'Startup' folder where it can be run again by just clicking it. I want to be able to execute certain commands at login without putting them in the 'Startup' folder.
This is actually quite simple. Just create the file %USERPROFILE%\login.cmd. That file will be executed automatically when you log in.
This is similar to my post about sourcing a file when you start a command shell. The difference with that is that it only applies to the command console and it is sourced for every cmd.exe shell you start, whereas the login.cmd file is loaded only once at login by Windows.
No comments:
Post a Comment