Search code examples
batch-filecmdbatch-processingxcopy

Batch: find several folders and create file for each


I am asking this in relation to this question: Batch: find file and rename it / find file and delete it I am trying to do the same thing, except as the question states, I am trying to list all the users in and set each one to a variable, put a link to my program into the startup, then go to the next user, and do the same, but the users vary from workstation to workstation. So I need it to look at the folder name (in relation to the user account name of course) and use it as a variable in the xcopy command.. I am in a rush writing this, so let me know if you need any clarification, hopefully it makes sense. Thanks to anyone who helps! :)


Solution

  • Sounds like the Rube Goldberg method of software deployment. Just put a link to your program into the All Users profile.

    copy shortcut.lnk "%ALLUSERSPROFILE%\Start Menu\Programs\Startup\"
    

    ...and done.

    I shudder to think of the maintenance nightmare your intended self-prescribed solution would cause. What happens when a new version of the software needs to be deployed? What if the updated version defaults to installing in a different directory than the previous? What happens when a user gets a new computer and hands-me-down the existing one to an intern / GA / lower-level peon? Goes on vacation and someone else fills in temporarily? You really should do the "All Users" thing.

    Or even better, include it in your domain policy login script.