web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Using Windows Task Scheduler to Copy Excel Spreadsheet

(0) ShareShare
ReportReport
Posted on by

Hello:

On Windows Server 2008 R2, we use Task Scheduler to copy an Excel spreadsheet from one folder to another on that server's C drive.  

The scripting at the end of this posting is an excerpt from the *.bat file that is used by Task Scheduler to conduct this copying.

Our end user places a spreadsheet in the first directory specified in the scripting.  Then, Task Scheduler uses the scripting to copy the spreadsheet to the new directory and renames the spreadsheet to "SpecialAPLoadInput.xlsx".

Up until a few weeks ago, there were no issues.  This copying, in fact, has been working for years.

Now, the copy of the spreadsheet will not open in the directory that it is copied to.

In fact, upon trying to open the copy, we get the message "Excel found unreadable content...".  In fact, if I copy that spreadsheet from the "new" directory to my laptop's Desktop and try to open it, I get a similar error.

So, instead of relying on Task Scheduler to copy the spreadsheet, I have to ask the user to e-mail the spreadsheet to me.  Then, I manually copy and paste the spreadsheet into the directory and rename it myself.  At that point, the spreadsheet can be successfully opened and used by our application that imports data from the spreadsheet.

One thing that I have noticed that happens consistently is that, no matter how big the original Excel spreadsheet is, the copying creates a copied file that is only 2KB in size.  It's as if Task Scheduler is starting the copying of the file, doesn't quite finish the copy, and we're left with a useless and ultimately corrupt copy of a spreadsheet.


Why would an Excel spreadsheet copied into a folder by Task Scheduler become corrupt, especially after years of successfully using this process?

Thanks!

John

Copy "C:\Scripts\OnDeck\SpecialAPLoad\*" "C:\Scripts\Input\Special APload\SpecialAPLoadInput.xlsx" /y

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Update:

    I solved this by switching from copy to xcopy to perform the copy.

    Thanks!

    John

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
mtabor Profile Picture

mtabor 1

#2
Victoria Yudin Profile Picture

Victoria Yudin 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans