{"id":566,"date":"2011-01-25T23:50:01","date_gmt":"2011-01-26T06:50:01","guid":{"rendered":"http:\/\/kmwoley.com\/blog\/?p=566"},"modified":"2014-11-21T00:41:08","modified_gmt":"2014-11-21T07:41:08","slug":"how-to-fix-garmin-dat-files-after-saving-history-failure","status":"publish","type":"post","link":"https:\/\/kmwoley.com\/blog\/how-to-fix-garmin-dat-files-after-saving-history-failure\/","title":{"rendered":"How to Fix Garmin DAT Files after &#8216;Saving History&#8217; Failure"},"content":{"rendered":"<p><a href=\"https:\/\/kmwoley.com\/blog\/wp-content\/uploads\/2011\/01\/ms-150-day-1-9-11-2010.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;\" title=\"MS 150 Day 1 9-11-2010\" src=\"https:\/\/kmwoley.com\/blog\/wp-content\/uploads\/2011\/01\/ms-150-day-1-9-11-2010-thumb.png\" alt=\"MS 150 Day 1 9-11-2010\" width=\"268\" height=\"202\" border=\"0\" \/><\/a><\/p>\n<p>Every now and then, the fabulous Garmin 705 will get screwed up while \u201cSaving History\u201d when plugging into the computer. What\u2019s good is that the data isn\u2019t lost. What\u2019s bad is that it can take some hacking at the internal structure of the file to fix it up.<\/p>\n<p>I\u2019ve put together a quick script that you can run on the files to fix them up. It\u2019s not perfect (it won\u2019t fix the lap data, for example). But it saves the time to stitch the files together by hand. The script is attached, and the instructions to use it are below.\u00a0 Be warned \u2013 it\u2019s a little geeky.<\/p>\n<p><!--more--><\/p>\n<p><strong>Requirements:<\/strong><\/p>\n<ol>\n<li>A Windows 7 machine (or a machine that has PowerShell V2 installed on it).<\/li>\n<li>This script file: <a href=\"https:\/\/kmwoley.com\/blog\/wp-content\/uploads\/2011\/01\/lapfilefixer.ps1\">lapfilefixer.ps1 (Size 3.2 KB)<\/a><br \/>\nTo make things easy, download it to your desktop.<\/li>\n<\/ol>\n<p><strong>PowerShell Setup:<\/strong><\/p>\n<ol>\n<li>From the Start Menu, search for \u201cPowerShell\u201d. Right click on PowerShell and select \u2018Run as Administrator\u2019<\/li>\n<li>Type in the following command and follow the prompt<br \/>\n<span style=\"font-family: Courier New;\">Set-ExecutionPolicy remotesigned<br \/>\n<\/span><a href=\"https:\/\/kmwoley.com\/blog\/wp-content\/uploads\/2011\/01\/image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;\" title=\"image\" src=\"https:\/\/kmwoley.com\/blog\/wp-content\/uploads\/2011\/01\/image-thumb.png\" alt=\"image\" width=\"426\" height=\"194\" border=\"0\" \/><\/a><\/li>\n<li>Close the Window, you\u2019re done here.<\/li>\n<\/ol>\n<p><strong>Copy the files from your Garmin:<\/strong><\/p>\n<ol>\n<li>Locate the .dat files on your Garmin. They will be in the (X:\\Garmin\\History\\Laps) directory. Each of the numbered folders represents a ride, start-to-stop.<\/li>\n<li>Copy the Laps folder onto your computer (for example, onto your Desktop)<\/li>\n<\/ol>\n<p><strong>Run the Script:<\/strong><\/p>\n<ol>\n<li>Start PowerShell (From the Start Menu, search for PowerShell, and run it)<\/li>\n<li>Navigate to the folder that contains your Lap*.dat files for the ride you want to fix (for example, C:\\Users\\Kevin\\Desktop\\Laps\\14)<br \/>\n<span style=\"font-family: Courier New;\">cd c:\\Users\\Kevin\\Desktop\\Laps\\14<\/span><\/li>\n<li>From this directory, run the script<br \/>\n<span style=\"font-family: Courier New;\">c:\\Users\\Kevin\\Desktop\\lapfilefixer.ps1<\/span><\/li>\n<li>The output will be in the \u2018<span style=\"font-family: Courier New;\">output.tcx<\/span><span style=\"font-family: Calibri;\">\u2019 file in the same directory.<\/span><\/li>\n<li>Import the \u2018<span style=\"font-family: Courier New;\">output.tcx<\/span><span style=\"font-family: Calibri;\">\u2019 file file into SportsTracks or Garmin Training Center, or whatever software you prefer.<\/span><\/li>\n<\/ol>\n<p><strong>End Notes:<\/strong><\/p>\n<p>I hope this helps you out! It certainly has saved me a bunch of time. Note, I\u2019m not responsible for any data loss or problems that the script causes. I\u2019ll try to help you out if you have questions, but I\u2019m no expert on the file format. I just hacked this together for myself. If you want some really good information, I\u2019ve found the following blog and thread helpful:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.photoscene.com\/kimandsteve\/476\/fixing-corrupted-garmin-tcx-files\">http:\/\/www.photoscene.com\/kimandsteve\/476\/fixing-corrupted-garmin-tcx-files<\/a><\/li>\n<li><a href=\"https:\/\/forums.garmin.com\/showthread.php?t=8360\">https:\/\/forums.garmin.com\/showthread.php?t=8360<\/a><\/li>\n<li>A good XML editor: <a title=\"First Object XML Editor\" href=\"http:\/\/www.firstobject.com\/dn_editor.htm\">First Object XML Editor<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Every now and then, the fabulous Garmin 705 will get screwed up while \u201cSaving History\u201d when plugging into the computer. What\u2019s good is that the data isn\u2019t lost. What\u2019s bad is that it can take some hacking at the internal structure of the file to fix it up. I\u2019ve put together a quick script that &hellip; <a href=\"https:\/\/kmwoley.com\/blog\/how-to-fix-garmin-dat-files-after-saving-history-failure\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to Fix Garmin DAT Files after &#8216;Saving History&#8217; Failure<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,244],"tags":[276,228,280,274,275,278,277,279,281],"class_list":["post-566","post","type-post","status-publish","format-standard","hentry","category-geek","category-pedal-wheels","tag-dat-files","tag-failure","tag-fix-dat-files","tag-garmin","tag-garmin-705","tag-history","tag-lap","tag-saving-history","tag-sportstracks"],"_links":{"self":[{"href":"https:\/\/kmwoley.com\/blog\/wp-json\/wp\/v2\/posts\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kmwoley.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kmwoley.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kmwoley.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/kmwoley.com\/blog\/wp-json\/wp\/v2\/comments?post=566"}],"version-history":[{"count":5,"href":"https:\/\/kmwoley.com\/blog\/wp-json\/wp\/v2\/posts\/566\/revisions"}],"predecessor-version":[{"id":3105,"href":"https:\/\/kmwoley.com\/blog\/wp-json\/wp\/v2\/posts\/566\/revisions\/3105"}],"wp:attachment":[{"href":"https:\/\/kmwoley.com\/blog\/wp-json\/wp\/v2\/media?parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kmwoley.com\/blog\/wp-json\/wp\/v2\/categories?post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kmwoley.com\/blog\/wp-json\/wp\/v2\/tags?post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}