{"id":71,"date":"2009-05-22T08:37:00","date_gmt":"2009-05-22T08:37:00","guid":{"rendered":"http:\/\/www.roysac.com\/blog\/wp-admin\/2009\/05\/microsoft-internet-explorer-search-providers-import-and-export\/"},"modified":"2009-05-22T08:37:00","modified_gmt":"2009-05-22T08:37:00","slug":"microsoft-internet-explorer-search-providers-import-and-export","status":"publish","type":"post","link":"http:\/\/www.roysac.com\/blog\/2009\/05\/microsoft-internet-explorer-search-providers-import-and-export\/","title":{"rendered":"Microsoft Internet Explorer Search Providers Import and Export"},"content":{"rendered":"<p>Microsoft Internet Explorer 7 and 8 and also Mozilla Fire Fox come with a feature called &#8220;Custom Search Providers&#8221; or Search Scopes. It allows you to add web sites and search engines to your search box to search them directly, if you need to. For example could you add Amazon.com search to your search providers and search the Amazon.com site directly from your search box, if you are looking for a book, CD or DVD and use Amazon.com as primary online shop for this kind of purchases.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" border=\"0\" alt=\"ie-custsearchproviders1\" align=\"left\" src=\"http:\/\/www.roysac.com\/blogimages\/iecustsearchproviders1.png\" width=\"353\" height=\"384\"><\/p>\n<p>You can get a selection of custom search providers at <a href=\"http:\/\/www.microsoft.com\/windows\/ie\/searchguide\/en-en\/default.mspx\" target=\"_blank\">this Microsoft web site<\/a>. There you can find a number of options for popular web sites and other search engines. Also available there is the option to create your own custom search provider for your favorite web site. This is possible, as long as the site provides a site search option and passes the search parameters, such as the search term in the URL. <\/p>\n<p>If you have a web site yourself and want to offer your visitors the option to add your site search to their web browser, then you can do that as well. I did this for my small project <a href=\"http:\/\/www.sqlhunt.com\/\" target=\"_blank\">SQLHunt.com<\/a>, a MS SQL Server resources meta-search engine based on <a href=\"http:\/\/www.google.com\/coop\/cse\/\" target=\"_blank\">Google Custom Search Engine<\/a>. See the link at the bottom of the homepage that reads &#8220;Widgets and Gadgets&#8221;. One of the options there is to add the SQLHunt.com search to your web browser.<\/p>\n<p>The search providers page for Internet Explorer on the Microsoft web site.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" border=\"0\" alt=\"ie-custsearchproviders2\" src=\"http:\/\/www.roysac.com\/blogimages\/iecustsearchproviders2.png\" width=\"700\" height=\"378\"><\/p>\n<p>All nice and good and I made myself good use of this feature. I have by now probably 20+ custom search providers added to my search box. Some via the Microsoft web site, others custom or via the &#8220;add&#8221; option at a web site directly. There is unfortunately no easy way to copy your search providers to another computer or to back it up and re-install, if you do a re-install of your current system.<\/p>\n<p>The search providers (or search scopes) are stored by Microsoft in the Windows System Registry. You can find your current search scopes and export them via the system tool RegEdit.exe to a file at<\/p>\n<p>HKEY_Current_User\\Software\\Microsoft\\Internet Explorer\\SearchScopes<\/p>\n<p>For each search provider exists a sub-key, in case that you only want to export specific search providers and not all of them. You can then take the exported file (with the extension .REG), copy it to the other machine and double click on it. You should be prompted to acknowledge that you want to import the file into the system registry. Do that and your search provider settings will be imported. <\/p>\n<p>Here is a simple BATCH script to export and import your search provider settings.<\/p>\n<h4>SearchScope.bat Code<\/h4>\n<p>Download the source code for <a href=\"http:\/\/www.roysac.com\/blogimages\/SearchScope.bat.txt\" target=\"_blank\">SearchScope.bat here<\/a> (you need to remove the additional .txt extension of the file when you save the file to your local hard disk).<\/p>\n<div>\n<pre><span>   1:  <\/span>@echo off<\/pre>\n<pre><span>   2:  <\/span>CLS<\/pre>\n<pre><span>   3:  <\/span><span>if<\/span> <span>\"%1\"<\/span>==<span>\"\"<\/span> (<span>CALL<\/span> :SELOPT) <span>ELSE<\/span> <span>SET<\/span> OPT=%1 <\/pre>\n<pre><span>   4:  <\/span><span>if<\/span> <span>\"%2\"<\/span>==<span>\"\"<\/span> <span>Call<\/span> :GETFP   <\/pre>\n<pre><span>   5:  <\/span>??<\/pre>\n<pre><span>   6:  <\/span><span>IF<\/span> %OPT%==IMPORT <span>Call<\/span> :DoImport<\/pre>\n<pre><span>   7:  <\/span><span>IF<\/span> %OPT%==EXPORT <span>Call<\/span> :DoExport<\/pre>\n<pre><span>   8:  <\/span>Echo Finished!<\/pre>\n<pre><span>   9:  <\/span>Echo.<\/pre>\n<pre><span>  10:  <\/span>pause<\/pre>\n<pre><span>  11:  <\/span><span>GOTO<\/span> :EOF<\/pre>\n<pre><span>  12:  <\/span>??<\/pre>\n<pre><span>  13:  <\/span>:SELOPT<\/pre>\n<pre><span>  14:  <\/span>echo Microsoft Custom Search Provider Import\/Export Tool<\/pre>\n<pre><span>  15:  <\/span>echo by Carsten Cumbrowski aka Roy\/SaC at http:\/\/www.roysac.com\/blog<\/pre>\n<pre><span>  16:  <\/span>echo.<\/pre>\n<pre><span>  17:  <\/span><span>SET<\/span> \/p OTmp=Enter (I) <span>to<\/span> Import, (E) <span>to<\/span> Export <span>or<\/span> (A) <span>to<\/span> Abort: <\/pre>\n<pre><span>  18:  <\/span><span>IF<\/span> <span>\"%OTmp%\"<\/span>==<span>\"I\"<\/span> <span>SET<\/span> OPT=IMPORT&<span>SET<\/span> OK=1<\/pre>\n<pre><span>  19:  <\/span><span>IF<\/span> <span>\"%OTmp%\"<\/span>==<span>\"i\"<\/span> <span>SET<\/span> OPT=IMPORT&<span>SET<\/span> OK=1<\/pre>\n<pre><span>  20:  <\/span><span>IF<\/span> <span>\"%OTmp%\"<\/span>==<span>\"E\"<\/span> <span>SET<\/span> OPT=EXPORT&<span>SET<\/span> OK=1<\/pre>\n<pre><span>  21:  <\/span><span>IF<\/span> <span>\"%OTmp%\"<\/span>==<span>\"e\"<\/span> <span>SET<\/span> OPT=EXPORT&<span>SET<\/span> OK=1<\/pre>\n<pre><span>  22:  <\/span><span>If<\/span> <span>NOT<\/span> <span>\"%OK%\"<\/span>==<span>\"1\"<\/span> <span>EXIT<\/span><\/pre>\n<pre><span>  23:  <\/span><span>GOTO<\/span> :EOF<\/pre>\n<pre><span>  24:  <\/span>??<\/pre>\n<pre><span>  25:  <\/span>:GETFP<\/pre>\n<pre><span>  26:  <\/span>echo.<\/pre>\n<pre><span>  27:  <\/span>echo Please Specify the name <span>and<\/span> path <span>for<\/span> the file <span>to<\/span> %OPT% <\/pre>\n<pre><span>  28:  <\/span>Echo Enter <span>\"a' to abort.<\/span><\/pre>\n<pre><span>  29:  <\/span>echo. <\/pre>\n<pre><span>  30:  <\/span>SET \/P FNAME=File Name: <\/pre>\n<pre><span>  31:  <\/span>if %OPT%==IMPORT (<\/pre>\n<pre><span>  32:  <\/span>  IF \"%FNAME%\"==\"\" EXIT<\/pre>\n<pre><span>  33:  <\/span>  IF NOT EXIST \"%FNAME%\" Call :GETFP<\/pre>\n<pre><span>  34:  <\/span>)<\/pre>\n<pre><span>  35:  <\/span>GOTO :EOF<\/pre>\n<pre><span>  36:  <\/span>??<\/pre>\n<pre><span>  37:  <\/span>:DoImport<\/pre>\n<pre><span>  38:  <\/span>REG Import %FNAME%>NUL 2>&1<\/pre>\n<pre><span>  39:  <\/span>Echo Search Scopes Imported<\/pre>\n<pre><span>  40:  <\/span>Goto :EOF<\/pre>\n<pre><span>  41:  <\/span>??<\/pre>\n<pre><span>  42:  <\/span>:DoExport<\/pre>\n<pre><span>  43:  <\/span>REG Export \"HKCU\\Software\\Microsoft\\Internet Explorer\\SearchScopes\" %FNAME%>Nul 2>&1<\/pre>\n<pre><span>  44:  <\/span>Echo Search Scopes Exported <span>to<\/span> %FNAME%<\/pre>\n<pre><span>  45:  <\/span><span>GOTO<\/span> :EOF<\/pre>\n<\/div>\n<p><\/p>\n<p>Here is a more complex example script. It reads the settings from the HKEY_USER branch rather than the HKEY_CURRENT_USER one. The script looks up the SID for the current user and exports the registry settings, replacing the SID with a place holder to be substituted when imported again elsewhere. <\/p>\n<p>This was more of a &#8220;proof of concept&#8221;, since you do not have to go through all this length as the script above illustrates. I got the &#8220;inspiration&#8221; from the blog post &#8220;<a href=\"http:\/\/community.landesk.com\/support\/docs\/DOC-2417\" target=\"_blank\">Working with Registry Keys in a Batch File<\/a>&#8221; by &#8220;rhyous&#8221; at the LandDesk User Community.<\/p>\n<p>However, this batch could be modified to export the settings from other users on the same machine. It was not easy to accomplish and very tricky to do. Just for a test, look at the code and tell honestly, if you understand every statement used there. \ud83d\ude42<\/p>\n<p>The only thing you would have to do, is replacing %%USERPROFILE%% with the path to the users home directory (e.G. &#8220;C:\\Documents and Settings\\UserName&#8221;<\/p>\n<h4>SearchScopesImportExport.bat Code<\/h4>\n<p>Download the source code for <a href=\"http:\/\/www.roysac.com\/blogimages\/SearchScopesImportExport.bat.txt\" target=\"_blank\">SearchScopesImportExport.bat here<\/a> (you need to remove the additional .txt extension of the file when you save the file to your local hard disk).<\/p>\n<p><\/p>\n<div>\n<pre><span>   1:  <\/span>@Echo off<\/pre>\n<pre><span>   2:  <\/span>cls<\/pre>\n<pre><span>   3:  <\/span>SETLOCAL ENABLEEXTENSIONS<\/pre>\n<pre><span>   4:  <\/span>SETLOCAL ENABLEDELAYEDEXPANSION<\/pre>\n<pre><span>   5:  <\/span><span>if<\/span> <span>\"%*\"<\/span>==<span>\"\"<\/span> <span>Goto<\/span> :ShowUsage<\/pre>\n<pre><span>   6:  <\/span><span>if<\/span> <span>\"%~2\"<\/span>==<span>\"\"<\/span> <span>Goto<\/span> :ShowUsage<\/pre>\n<pre><span>   7:  <\/span>??<\/pre>\n<pre><span>   8:  <\/span><span>SET<\/span> RootKey=<span>\"HKLM\\software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\"<\/span><\/pre>\n<pre><span>   9:  <\/span><span>Set<\/span> Val=ProfileImagePath<\/pre>\n<pre><span>  10:  <\/span>??<\/pre>\n<pre><span>  11:  <\/span><span>Call<\/span> <span>SET<\/span> CurProf=%%USERPROFILE%%<\/pre>\n<pre><span>  12:  <\/span><span>SET<\/span> CurSID=<span>\"\"<\/span><\/pre>\n<pre><span>  13:  <\/span>??<\/pre>\n<pre><span>  14:  <\/span>Echo Determining Current User<span>'s SID ...<\/span><\/pre>\n<pre><span>  15:  <\/span><span>Call<\/span> :GETSID %RootKey%<\/pre>\n<pre><span>  16:  <\/span>Echo The current users SID <span>is<\/span> %CurSID%<\/pre>\n<pre><span>  17:  <\/span><span>Call<\/span> <span>Set<\/span> RegTmp=%Temp%\\%CurSID%_SearchScopes.reg<\/pre>\n<pre><span>  18:  <\/span>??<\/pre>\n<pre><span>  19:  <\/span><span>IF<\/span> <span>\"%1\"<\/span>==<span>\"export\"<\/span> <span>Call<\/span> :ExportScopes <span>\"%~2\"<\/span><\/pre>\n<pre><span>  20:  <\/span><span>IF<\/span> <span>\"%1\"<\/span>==<span>\"import\"<\/span> <span>Call<\/span> :ImportScopes <span>\"%~2\"<\/span><\/pre>\n<pre><span>  21:  <\/span>??<\/pre>\n<pre><span>  22:  <\/span>Echo.<\/pre>\n<pre><span>  23:  <\/span>echo Done Processing<\/pre>\n<pre><span>  24:  <\/span>echo.<\/pre>\n<pre><span>  25:  <\/span>pause<\/pre>\n<pre><span>  26:  <\/span>echo.<\/pre>\n<pre><span>  27:  <\/span><span>Goto<\/span> :EOF<\/pre>\n<pre><span>  28:  <\/span>??<\/pre>\n<pre><span>  29:  <\/span>??<\/pre>\n<pre><span>  30:  <\/span>:GETSID<\/pre>\n<pre><span>  31:  <\/span><span>FOR<\/span> \/F <span>\"tokens=7* delims=\\\"<\/span> %%i <span>IN<\/span> (<span>'REG QUERY \"%~1\"') DO (<\/span><\/pre>\n<pre><span>  32:  <\/span>  <span>FOR<\/span> \/F <span>\"tokens=2*\"<\/span> %%a <span>in<\/span> (<span>'REG QUERY \"%~1\\%%~i\" \/v %Val% ^|FINDSTR %Val%') DO (<\/span><\/pre>\n<pre><span>  33:  <\/span>     <span>CALL<\/span> <span>SET<\/span> ldclientdir=%%b<\/pre>\n<pre><span>  34:  <\/span>     <span>if<\/span> <span>\"%CurProf%\"<\/span>==<span>\"!ldclientdir!\"<\/span> (<\/pre>\n<pre><span>  35:  <\/span>       <span>Set<\/span> CurSID=%%~i<\/pre>\n<pre><span>  36:  <\/span>     )<\/pre>\n<pre><span>  37:  <\/span>  )<\/pre>\n<pre><span>  38:  <\/span>)<\/pre>\n<pre><span>  39:  <\/span><span>GOTO<\/span> :EOF<\/pre>\n<pre><span>  40:  <\/span>??<\/pre>\n<pre><span>  41:  <\/span>:ExportScopes<\/pre>\n<pre><span>  42:  <\/span>echo Exporting Search Scope Settings ...<\/pre>\n<pre><span>  43:  <\/span>REG Export <span>\"HKU\\%CurSID%\\Software\\Microsoft\\Internet Explorer\\SearchScopes\"<\/span> %RegTmp%>Nul 2>&1<\/pre>\n<pre><span>  44:  <\/span>Echo Replacing SID <span>with<\/span> place-holder CURRENTUSERSID ...<\/pre>\n<pre><span>  45:  <\/span><span>Call<\/span> :SandR %RegTmp% <span>\"%~1\"<\/span> %%CurSID%% CURRENTUSERSID<\/pre>\n<pre><span>  46:  <\/span><span>goto<\/span> :eof<\/pre>\n<pre><span>  47:  <\/span>??<\/pre>\n<pre><span>  48:  <\/span>:SandR<\/pre>\n<pre><span>  49:  <\/span>::1 = input file<\/pre>\n<pre><span>  50:  <\/span>::2 = output file<\/pre>\n<pre><span>  51:  <\/span>::3 = search <span>string<\/span><\/pre>\n<pre><span>  52:  <\/span>::4 = replacement value<\/pre>\n<pre><span>  53:  <\/span><span>if<\/span> EXIST <span>\"%~2\"<\/span> DEL \/Q <span>\"%~2\"<\/span><\/pre>\n<pre><span>  54:  <\/span><span>for<\/span> \/f <span>\"tokens=1,* delims=]\"<\/span> %%a <span>in<\/span> (<span>'\"type \"%~1\"|find \/n \/v \"\"\"') do (<\/span><\/pre>\n<pre><span>  55:  <\/span>   <span>CALL<\/span> <span>SET<\/span> _result=%%b<\/pre>\n<pre><span>  56:  <\/span>   <span>if<\/span> <span>NOT<\/span> <span>\"%%b\"<\/span>==<span>\"\"<\/span> (<\/pre>\n<pre><span>  57:  <\/span>     <span>CALL<\/span> <span>SET<\/span> _fchar=%%_result:~0,1%%<\/pre>\n<pre><span>  58:  <\/span>     <span>if<\/span> <span>\"!_fchar!\"<\/span>==<span>\"[\"<\/span> (<\/pre>\n<pre><span>  59:  <\/span>       <span>set<\/span> <span>\"line=%%b\"<\/span><\/pre>\n<pre><span>  60:  <\/span>       <span>if<\/span> defined line (<\/pre>\n<pre><span>  61:  <\/span>          <span>call<\/span> <span>set<\/span> <span>\"line=echo.%%line:%3=%4%%\"<\/span><\/pre>\n<pre><span>  62:  <\/span>          <span>for<\/span> \/f <span>\"delims=\"<\/span> %%X <span>in<\/span> (<span>'\"echo.\"%%line%%\"\"') do %%~X>>\"%~2\"<\/span><\/pre>\n<pre><span>  63:  <\/span>       )   <span>ELSE<\/span> echo.>><span>\"%~2\"<\/span><\/pre>\n<pre><span>  64:  <\/span>     ) <span>else<\/span> (<\/pre>\n<pre><span>  65:  <\/span>         echo %%b>><span>\"%~2\"<\/span><\/pre>\n<pre><span>  66:  <\/span>     )<\/pre>\n<pre><span>  67:  <\/span>   ) <span>else<\/span> (<\/pre>\n<pre><span>  68:  <\/span>       echo.>><span>\"%~2\"<\/span><\/pre>\n<pre><span>  69:  <\/span>   )<\/pre>\n<pre><span>  70:  <\/span>)<\/pre>\n<pre><span>  71:  <\/span><span>goto<\/span> :eof<\/pre>\n<pre><span>  72:  <\/span>??<\/pre>\n<pre><span>  73:  <\/span>:ImportScopes<\/pre>\n<pre><span>  74:  <\/span><span>if<\/span> <span>NOT<\/span> EXIST <span>\"%~1\"<\/span> <span>GOTO<\/span> :ShowUsage<\/pre>\n<pre><span>  75:  <\/span>echo Preparing Registry Data <span>for<\/span> Import ...<\/pre>\n<pre><span>  76:  <\/span>echo Replacing place-holder CURRENTUSERSID <span>with<\/span> SID ...<\/pre>\n<pre><span>  77:  <\/span><span>if<\/span> EXIST %RegTmp% Del %RegTmp%<\/pre>\n<pre><span>  78:  <\/span><span>Call<\/span> :SandR <span>\"%~1\"<\/span> %RegTmp% CURRENTUSERSID %%CurSID%%<\/pre>\n<pre><span>  79:  <\/span>Echo Importing Search Scopes ...<\/pre>\n<pre><span>  80:  <\/span><span>if<\/span> EXIST %RegTmp% REG Import %RegTmp%>NUL 2>&1<\/pre>\n<pre><span>  81:  <\/span><span>goto<\/span> :eof<\/pre>\n<pre><span>  82:  <\/span>??<\/pre>\n<pre><span>  83:  <\/span>??<\/pre>\n<pre><span>  84:  <\/span>:ShowUsage<\/pre>\n<pre><span>  85:  <\/span>cls<\/pre>\n<pre><span>  86:  <\/span>echo.<\/pre>\n<pre><span>  87:  <\/span>echo USAGE<\/pre>\n<pre><span>  88:  <\/span>echo   Script.bat import^|export IMPORTFILE.REG^|OUTPUTFILE.REG<\/pre>\n<pre><span>  89:  <\/span>echo.<\/pre>\n<pre><span>  90:  <\/span>echo Example Export of current Search Scopes <span>to<\/span> a file <\/pre>\n<pre><span>  91:  <\/span>echo <span>with<\/span> the name MySearchScopes <span>to<\/span> the local directory C:\\Data<\/pre>\n<pre><span>  92:  <\/span>echo.<\/pre>\n<pre><span>  93:  <\/span>echo   Script.bat export c:\\Data\\MySearchScopes.reg<\/pre>\n<pre><span>  94:  <\/span>echo.<\/pre>\n<pre><span>  95:  <\/span>Echo Example Import of Search Scopes from file generated via this script<\/pre>\n<pre><span>  96:  <\/span>Echo.<\/pre>\n<pre><span>  97:  <\/span>Echo  script.bat import c:\\import\\MySearchScopes.reg<\/pre>\n<pre><span>  98:  <\/span>echo.<\/pre>\n<pre><span>  99:  <\/span>pause<\/pre>\n<pre><span> 100:  <\/span>echo.<\/pre>\n<\/div>\n<p><\/p>\n<\/p>\n<p>That&#8217;s it. I hope that you will find this little tool and information useful.<\/p>\n<p>Cheers!<\/p>\n<p>Carsten aka Roy\/SAC<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft Internet Explorer 7 and 8 and also Mozilla Fire Fox come with a feature called &#8220;Custom Search Providers&#8221; or Search Scopes. It allows you to add web sites and search engines to your search box to search them directly, if you need to. For example could you add Amazon.com search to your search providers [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-71","post","type-post","status-publish","format-standard","hentry","category-tools"],"_links":{"self":[{"href":"http:\/\/www.roysac.com\/blog\/wp-json\/wp\/v2\/posts\/71","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.roysac.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.roysac.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.roysac.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.roysac.com\/blog\/wp-json\/wp\/v2\/comments?post=71"}],"version-history":[{"count":0,"href":"http:\/\/www.roysac.com\/blog\/wp-json\/wp\/v2\/posts\/71\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.roysac.com\/blog\/wp-json\/wp\/v2\/media?parent=71"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.roysac.com\/blog\/wp-json\/wp\/v2\/categories?post=71"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.roysac.com\/blog\/wp-json\/wp\/v2\/tags?post=71"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}