Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello, Hope you can help me. I learned basic DOS 15 years ago and haven't used it at all in the last 10 years. I need a batch file to MOVE a single file from one location to another, but also prompts the user to enter a "claim" number, which is actually file name with a .xls at the end.
Can the batch file append the .xls to the end of the file name they key in?
Example: If the Claim# they key in, when prompted, is 123456789 then the command would look like
move H:\Benefit\Example\123456789.xls H:\Benefit\Example\60 Day Hold\I would also like to have the batch file validate the success of the move. Example, if the move was successful then echo a message like, "Move Complete". If the claim number was NOT found then take them back to the prompt that asks them to enter the claim number.
If you can provide any help at all my team and I would certainly appreciate it. Thanks so much for your tim
Angel

I learned basic DOS 15 years ago and haven't used it at all in the last 10 years.
Well then you're in luck! DOS died 13 years ago, so you'll never need to get better at it!If you want a Command Script, though, then I can help you.
@ECHO OFF
SET /P claim=Claim #:
MOVE "H:\Benefit\Example\%claim%.xls" "H:\Benefit\Example\60 Day Hold\" >NUL 2>&1 &&ECHO Move Complete ||"%~F0"
Yes, that third line is really that long. No, I'm not throwing off the formatting for the sheer thrill of it.

I can't wait to get back to the office and kick this off. You have no idea how much I appreciate this! Thank you so very very much.
You're awesome... Have a GREAT weekend!
Angel
PS Sure is a good thing I didn't have to get out the old books and try to figure it out... It would have never happened. lol

"Can the batch file append the .xls to the end of the file name they key in?"
Additonally you can't just tack a xls extension on a file and expect Excel to open it. FYI
Are you ready for where Microsoft wants you to go today?

Dear Razor2.3, The command script worked like a dream! My Claims Processors are moving files like crazy and I have some piece of mind since they are not using the ole Windows drag and drop. I knew if they used drag and drop they would be grabbing the wrong files or moving them to places they didn't belong. Nothing is fool proof but this sure adds a level of protection I feel better about. Thank you so much again.
Everyone, thanks for taking the time to share your comments and suggestions. I do appreciate you all!!!
Angel

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |