Timestamp as Name of File


Joined
Aug 12, 2011
Messages
1
Reaction score
0
I was reading another thread: https://www.pcreview.co.uk/forums/batch-file-timestamp-t1466494.html

Where the person was wanting to use the timestamp as the new name of the batch file. I was reading through and I saw what was necessary, but now I'm running into syntax errors.

Basically, what I am trying to get my batch file to do is two very simple things:

1. Backup copy of excel spreadsheet with timestamp of date and time when the file was saved and save to specified location on network
2. Delete the data from the old file and start with a fresh data

One would think that would be simple. But I'm struggling with it.

This is what I have in my batch file:

@echo off
copy C:\Users\nhoy\Documents\test.txt X:\_Nhoy
xcopy c:\users\nhoy\documents\testfolder\test.txt c:\users\nhoy\documents\test.txt /Y
ren c:\users\nhoy\documents\test c:\users\nhoy\documents\test-%date%_at_%time%.txt
pause

So, I'm hoping you all can help me out here. The main issue I'm having is with the REN command on the fourth line. That's where I'm getting the syntax error.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Batch File Timestamp 13
Timestamp Problem 5
delete by timestamp 1
Timestamp Ping. 10

Top