Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file to rename "unknown" file (*.prn)

Status
Not open for further replies.

lmohr79

Technical User
Jan 18, 2005
39
US
Fair warning - I'm a "by the seat of my pants" user, so this may be very simple, but I'm stumped:

I'm trying to build a batch file that renames a daily *.prn file to mmddyyyy.txt file.

I know how to rename to today's date, but don't know how to "find" the name of the .prn file - the program that produces the .prn file just gives it an arbitrary name each day.

Using dir *.prn /B will give me just the file name, but how do I stick this in a variable?

I've researched the SET and FOR commands, but not sure what syntax to use:

SET myvar=dir *.prn /B

This gives "dir *.prn /B" as the value of the variable.

And if I enclose the dir *.prn /B in quotes, I get the same result.

Since "dir" isn't a file that the FOR command can find, that didn't work also.

Am I all wet? Any help will be appreciated!
 
If it is the only .prn in the folder, then just:

rename *.prn whaterver.prn

and it will be renamed whatever it is called.

Jock
 
Thank you Jock!

Why is it that the simple things just bog me down!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top