{"action":"created","issue":{"url":"https://api.github.com/repos/chenall/grub4dos/issues/69","labels_url":"https://api.github.com/repos/chenall/grub4dos/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/chenall/grub4dos/issues/69/comments","events_url":"https://api.github.com/repos/chenall/grub4dos/issues/69/events","html_url":"https://github.com/chenall/grub4dos/issues/69","id":94656481,"number":69,"title":"Query: How to detect if running 0.4.5c or 0.4.6a","user":{"login":"steve6375","id":1469350,"avatar_url":"https://avatars.githubusercontent.com/u/1469350?v=3","gravatar_id":"","url":"https://api.github.com/users/steve6375","html_url":"https://github.com/steve6375","followers_url":"https://api.github.com/users/steve6375/followers","following_url":"https://api.github.com/users/steve6375/following{/other_user}","gists_url":"https://api.github.com/users/steve6375/gists{/gist_id}","starred_url":"https://api.github.com/users/steve6375/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steve6375/subscriptions","organizations_url":"https://api.github.com/users/steve6375/orgs","repos_url":"https://api.github.com/users/steve6375/repos","events_url":"https://api.github.com/users/steve6375/events{/privacy}","received_events_url":"https://api.github.com/users/steve6375/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-13T07:23:03Z","updated_at":"2015-08-04T03:46:21Z","closed_at":null,"body":"Is the version number and letter stored in an 'official' memory location?\r\nI would like to detect if I am currently running 0.4.5c or 0.4.6a.\r\nUsing cat --locate=\"0.4.6a\" (md)0xaaaa+0xbb  is not reliable when reloading different grldr:\r\ne.g.\r\nchainloader /grldr046\r\nthen if we load 0.4.5c...\r\nchainloader /grldr045\r\nand we have both \"0.4.5c\" and \"0.4.6a\" strings in memory because 0.4.6a is larger than 0.4.5c.\r\n\r\nWhat is best method to determine what version is running (not date string, but version).\r\n\r\nMy code is:\r\niftitle [cat --locate=\"GRUB4DOS 0.4.5\" (md)0x200+0x50]  Load Grub4dos 0.4.6a\r\necho Loading Grub4Dos 0.4.6...\r\nchainloader /grldr_046\r\n\r\n::check for help text which only occurs in 0.4.6\r\niftitle [cat --locate=\"usb --delay\" (md)0x200+0x50 && if \"%GRUB_DUN%\"==\"\"] USB DRIVER\r\ndebug 1\r\nusb --init\r\necho\r\ndebug off\r\npause --wait=3\r\n:: don't do usb --init again in menu.lst\r\nset GRUB_DUN=1\r\nconfigfile /menu.lst\r\n\r\niftitle [cat --locate=\"usb --delay\" (md)0x200+0x50] Load grub4dos 0.4.5c\r\necho Loading Grub4Dos 0.4.5...\r\nchainloader /grldr_045\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/chenall/grub4dos/issues/comments/127469783","html_url":"https://github.com/chenall/grub4dos/issues/69#issuecomment-127469783","issue_url":"https://api.github.com/repos/chenall/grub4dos/issues/69","id":127469783,"user":{"login":"moxiea","id":12506332,"avatar_url":"https://avatars.githubusercontent.com/u/12506332?v=3","gravatar_id":"","url":"https://api.github.com/users/moxiea","html_url":"https://github.com/moxiea","followers_url":"https://api.github.com/users/moxiea/followers","following_url":"https://api.github.com/users/moxiea/following{/other_user}","gists_url":"https://api.github.com/users/moxiea/gists{/gist_id}","starred_url":"https://api.github.com/users/moxiea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moxiea/subscriptions","organizations_url":"https://api.github.com/users/moxiea/orgs","repos_url":"https://api.github.com/users/moxiea/repos","events_url":"https://api.github.com/users/moxiea/events{/privacy}","received_events_url":"https://api.github.com/users/moxiea/received_events","type":"User","site_admin":false},"created_at":"2015-08-04T03:46:20Z","updated_at":"2015-08-04T03:46:20Z","body":"Like javascript in different web browsers,I think you can use the feature detection:\r\n\r\n```bash\r\nerrorcheck off\r\n#(hd) is for new version only，so we use 'cat (hd)+1' detect version\r\ncat (hd)+1\r\n#older version return 23(Error while parsing number)，newer version return 21\r\ncheckrange 23 errnum && write 0x60100 3\r\nerrorcheck on\r\ncheckrange 3 read 0x60100 && kernel\r\n```\r\n\r\nbut i did not test more, so u can try first.\r\n\r\n[source from](http://chenall.net/post/grub4dos_micrope/)"}}