Hello,
First off i'm a C++ programmer so know little about Batch files (I understand how to run them and stuff) so I might need some pretty beginner stuff, second of all I have Googled for this.
I have a batch file that starts my server, however before I do this I want to make a backup complete with the date. Something like this:
backups/StartBak.%m.%h.%d.%M.%y
(minute, hour, day, Month, year)
I use xcopy to copy the folder but I am stuck with getting the time/date values... I understand variables from my little batch experience (besides variables are fundamental so there should be plenty on Google) so that wont be a problem.
So does anyone know basic operations such as setting a variable to the current minute?
3 replies to this topic
#1
Posted 19 June 2011 - 11:15 PM
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).
|
|
|
#2
Posted 20 June 2011 - 11:46 AM
I guess you need the "date" command on windows shell
Here is sufficient info
Batch files - DATE and TIME
Basically i googled for batch files / cmd.exe commands etc.
Here is sufficient info
Batch files - DATE and TIME
Basically i googled for batch files / cmd.exe commands etc.
Edited by fayyazlodhi, 20 June 2011 - 11:49 AM.
Fixing the copied link
Today is the first day of the rest of my life
#3
Posted 20 June 2011 - 02:15 PM
It is more hard to do in NT batch (you can see many examples online with padding substring and whatnot.)
If you use Windows 7 or Server 2008 the Powershell has a date and time class.
If you use Windows 7 or Server 2008 the Powershell has a date and time class.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#4
Posted 21 June 2011 - 01:33 PM
Errr I found that webpage, it confused me :(.
I'm running Vista...
I'm running Vista...
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









