3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Roll your own version control/automated backup

Step 7Snapshot.vbs explained

snapshot.vbs explained
Again, I'll run through the code of snapshot.vbs. You don't have to know VBScript inside-out to understand this file, although basic knowledge will help.

Dim FriendlyDateDim FriendlyTimeFriendlyDate = Replace(Date, "/", "-")FriendlyTime = Mid(Replace(Time, ":", "-"), 1, 5)

This creates two variables, FriendlyDate and FriendlyTime, and sets them to the current date and time. The replace functions are there because the date in VBSCript is represented in the form 28/11/2008, but Windows doesn't like the slash characters in a file name, so they are replaced with dashes. The same is done to the : characters in the time (12:34:56). The Mid command also strips off the seconds from the time, so "28/11/2008_12:34:56" becomes "28-11-2008_12-34".

Dim WShellSet WShell = CreateObject("Wscript.Shell")

This part is creating a shell object, effectively a command prompt for VBScript, so that it can use command line commands like "move".

WShell.Run ("cmd /c move " + Wscript.Arguments(0) + " .\Backups\" + FriendlyDate + "_" + FriendlyTime + "_" + Wscript.Arguments(0))

This tells VBScript to issue a move command to its command line object. To break this line down further would require me to get into the details of how VBScript handles strings so I will refrain from doing that. Essentially, WScript.Arguments(0) becomes the filename you passed to the script earlier (archive.zip) and FriendlyDate and FriendlyTime become the actual text value of the date and time, for instance "18-10-2008" and "14-30". The plus characters join the various bits together into one long string.

The final command that is passed to the command line looks like
move archive.zip .\Backups\18-10-2008_14-30_archive.zip. If you want to save your backups into a different location then you can change the name of the folder from ".\Backups\" to, for instance, "E:\My_Lovely_Version_Control\". If you don't want the time stamps, then you can remove the "+ FriendlyTime" but then only one archive per day can be stored (any further backups will overwrite the existing archive).

« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
148
Followers
18
Author:PKM