Here's the scenario. I want to rename a file from within a CMD file.......... OK, now that you've stopped laughing, let me elaborate.
There are a couple of wrinkles:
- as part of the rename, I want the date tacked onto the end of the filename, ahead of the extension: e.g. "This Is The File To Rename.txt" will become "This Is The File To Rename_2012-08-01.txt".
- the batch file has to be run from a Scheduled Task.
- how to get the date in the correct format, without altering the System Date and Time settings. Since different people have different preferences for the date format, this can be tricky. Trying to use some formats will cause the batch file to fail; for example, if the date format includes slashes '/'.
- how to get the Rename command to run from a CMD file that's launched by a Scheduled Task.
To speed things up, let me cover a few of the simpler questions:
- the CMD file is running from the client's Win7 computer.
- the Scheduled Task is using the client's login creds.
- the client's ID is part of Administrators.
- the batch file works perfectly when run interactively from the client's session; it only fails when run as a Scheduled Task
Anyone got some magic smoke I can tap into?














