Search code examples
windowsbatch-filecommand-linespecial-folders

Access "Start up" folder from CMD?


How can I get the path of the start up folder from a batch file? The only way I found was to look in the registry but I don't think thats possible with CMD.


Solution

  • This will set STARTUP to the location of the startup folder:

    for /F "skip=4 tokens=3*" %%j in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Common Startup"') do set STARTUP=%%k
    

    (skip=4 is for XP, use skip=2 for Windows 7. I don't have Vista to try the command there)

    Also available (change the value after /v):

    Common AppData
    Common Programs
    Common Documents
    Common Desktop
    Common Start Menu
    CommonPictures
    CommonMusic
    CommonVideo
    Common Templates
    Common Favorites
    Common Startup
    Common Administrative Tools