{"id":59,"date":"2008-03-28T16:35:19","date_gmt":"2008-03-28T20:35:19","guid":{"rendered":"http:\/\/www.dev-notes.com\/blog\/?p=59"},"modified":"2018-03-11T21:35:19","modified_gmt":"2018-03-12T01:35:19","slug":"set-up-a-log-off-script-to-do-backup-2","status":"publish","type":"post","link":"https:\/\/www.dev-notes.com\/blog\/2008\/03\/28\/set-up-a-log-off-script-to-do-backup-2\/","title":{"rendered":"Set up a log off script to do backup"},"content":{"rendered":"<p>One possibility for the Windows log off script is to copy some data from the machine being logged off (perhaps being shut down?) to another for backup purposes. For example, I grab my Firefox settings and make a copy of it at &#8220;D:\\systemBackup\\windows\\mozilla\\&#8221;. You may wish to expand this to include others; maybe your FTP program&#8217;s configuration file that is found in &#8220;C:\\Program Files&#8221;? Or progress of your favorite games? Below is what I have in my log off script, which is written as a batch file.<\/p>\n<pre class=\"code\">@echo off\r\nset backupcmd=xcopy \/c \/d \/e \/h \/r \/y\r\n\r\necho Backing up Firefox settings...\r\n%backupcmd% \"C:\\Documents and Settings\\me\\Application Data\\Mozilla\\*.*\" \"D:\\systemBackup\\windows\\mozilla\\\"\r\n\r\necho Backing up my docs...\r\n%backupcmd% \"C:\\docs\\*.*\" \"D:\\docs\\*.*\"\r\n\r\necho Backing up a file...\r\n%backupcmd% \"C:\\john\\doe.txt\" \"D:\\john\\doe.txt\"<\/pre>\n<p>Note that in this example, I made use of the xcopy command found in all versions of Windows. The switches I used with the command allow us to copy only those files that had been changed, so the amount of time required to copy files may not be so much.<\/p>\n<p>To set up this log off script, type in &#8220;c:\\windows\\system32\\gpedit.msc&#8221; in your Run dialogue and click OK. Go to the User Configuration-Scripts (Logon\/Logoff) section and add your script. This script will now fire the next time you log off.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Whenever a user logs off of a Windows machine, we can trigger an action on that event to run a log off script, which can be extremely useful. In this example, we use it to set up a simple file backup procedure.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-windows"],"_links":{"self":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/comments?post=59"}],"version-history":[{"count":3,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/59\/revisions"}],"predecessor-version":[{"id":168,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/59\/revisions\/168"}],"wp:attachment":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/media?parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/categories?post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/tags?post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}