Aegis Posted August 29, 2006 Share Posted August 29, 2006 I would like to rename a few thousand text files through batch to a randomly-generated GUID filename. Does anyone know how to do this? I'm thinking it might be possible by using a third-party command-line GUID generator and setting a variable to the program's output, then creating a FOR loop. Link to comment Share on other sites More sharing options...
LLXX Posted August 29, 2006 Share Posted August 29, 2006 This is M$'s own GUIDGEN: http://www.microsoft.com/downloads/details...39-ADB270833AFCHere's a command-line version: http://webhome.idirect.com/~jhonz/Utilities.HTMThere's a whole lot more of these things, just Google "guidgen" and you'll find moar. Link to comment Share on other sites More sharing options...
Aegis Posted August 29, 2006 Author Share Posted August 29, 2006 Yes, I've found uuidgen.exe already. It outputs a single GUID without the brackets, so I redirected its output to a temporary file:@echo off:loopuuidgen.exe > temp.datfor /f %%i in (temp.dat) do set tempuuid=%%igoto loopThat generates an infinite amount of GUID's for my use. My next step was to then call another batch file and do a "for" loop to rename all *.txt files to %tempguid%. That's when I first found out that "environmental variables" apply only to a single cmd.exe session. Any help is appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now