Jump to content

basic .bat


Recommended Posts

There's some basic file manipulation that I have to do at my job on a regular basis, so I decided to try my hand at scripting. I was having a bit of trouble, so I figured I'd come here :) It's just a simple .BAT.

 

Objective:

Delete old directory from the user's desktop (always ends in suffix *_Agenda)

Copy new directory (changes weekly, format is Date_Agenda) to desktop.

Open date_agenda folder, and start the date_agenda.docx file.

 

Problems:

copy X:\ command only copies files; it does not copy entire directories.

The start command does not work, as it needs an exact filename to start and the filename changes weekly. Is there a way around this?

 

@echo off
echo Deleting old board files. 
del c:\users\board\desktop\*_Agenda
echo Complete!
echo Finding Directory....
cd X:
dir X:
echo Found directory, copying. Please wait.
copy X:\date_agenda C:\users\board\desktop\
echo Completed copying.
start c:\users\board\desktop\date_agenda\date_agenda.docx
pause

guideicon.png
Link to comment
Share on other sites

Is the date format always the same? If you're running this file weekly it might be possible to grab the system date and figure out the folder name that way.

polvCwJ.gif
"It's not a rest for me, it's a rest for the weights." - Dom Mazzetti

Link to comment
Share on other sites

Hmm, ok, I'll try to find that out. What you want to do logic wise is grab the current date, append it to the _agenda file name, blah blah blah.

 

http://en.kioskea.net/forum/affich-16514-batch-file-for-one-current-date-in-text-file

 

This might help you.

polvCwJ.gif
"It's not a rest for me, it's a rest for the weights." - Dom Mazzetti

Link to comment
Share on other sites

No problem, glad you got it working :)

 

If you want, I know there's a simple free batch to EXE converter out there somewhere :P Don't remember a name/url though.

polvCwJ.gif
"It's not a rest for me, it's a rest for the weights." - Dom Mazzetti

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.