{"id":65853,"date":"2006-12-13T14:44:00","date_gmt":"2006-12-13T14:44:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2006\/12\/13\/how-can-i-create-a-shortcut-that-opens-internet-explorer-with-the-address-bar-hidden\/"},"modified":"2006-12-13T14:44:00","modified_gmt":"2006-12-13T14:44:00","slug":"how-can-i-create-a-shortcut-that-opens-internet-explorer-with-the-address-bar-hidden","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-create-a-shortcut-that-opens-internet-explorer-with-the-address-bar-hidden\/","title":{"rendered":"How Can I Create a Shortcut That Opens Internet Explorer With the Address Bar Hidden?"},"content":{"rendered":"<p><img decoding=\"async\" class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" height=\"34\" alt=\"Hey, Scripting Guy! Question\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" align=\"left\" border=\"0\"><\/p>\n<p>Hey, Scripting Guy! How can I create a shortcut that opens Internet Explorer with the address bar hidden?<\/p>\n<p>&#8212; WA<\/p>\n<p><img decoding=\"async\" height=\"5\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" border=\"0\"><img decoding=\"async\" class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" height=\"34\" alt=\"Hey, Scripting Guy! Answer\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" align=\"left\" border=\"0\"><a href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><img decoding=\"async\" class=\"farGraphic\" title=\"Script Center\" height=\"288\" alt=\"Script Center\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" align=\"right\" border=\"0\"><\/a><\/p>\n<p>Hey, WA. You know, any time a science fiction writer starts to run low on ideas he or she writes a story in which someone goes to bed and then wakes up in the morning to find that the world has completely changed overnight. Why? Because someone somewhere built a time machine, went back in time, and then did something that changed the future. (Yes, we know: time machines all include a warning sticker that tells people to avoid doing <i>anything<\/i> that might change the future. But nobody ever pays attention to those stickers.)<\/p>\n<p>Something very similar seems to have happened here. When the Scripting Guy who writes this column went to bed last night, he knew that there was an easy and obvious answer to this question; in fact he was <i>positive<\/i> that there was an Internet Explorer startup switch that could be used for this very purpose. And yet, when he woke up this morning he discovered that there really <i>wasn\u2019t<\/i> such a startup switch. Could he have been wrong? That\u2019s a bit far-fetched, don\u2019t you think? It\u2019s far more likely that someone went back in time and removed the hide-the-address-bar startup switch from Internet Explorer. Disaster!<\/p>\n<p>But have no fear; the Scripting Guys never allow some reckless time traveler to keep them from answering a question. Instead, we came up with a compromise solution, one that requires two items: a script, and a shortcut that calls that script.<\/p>\n<p>Let\u2019s start with the script:<\/p>\n<pre class=\"codeSample\">Set objExplorer = CreateObject(\"InternetExplorer.Application\")\nstrWebSite = Wscript.Arguments(0)\nobjExplorer.Navigate strWebSite\nobjExplorer.AddressBar = 0\nobjExplorer.Visible = 1\n<\/pre>\n<p>As you can see, there\u2019s not much to this. We start out by creating an instance of the <b>InternetExplorer.Application<\/b> object; as the name implies, that\u2019s going to give us a running instance of Internet Explorer that we can call our own. We then use this line of code to take the first argument supplied to our script and store it in a variable named strWebSite:<\/p>\n<pre class=\"codeSample\">strWebSite = Wscript.Arguments(0)\n<\/pre>\n<p>Where\u2019s that argument going to come from? We\u2019ll explain that in just a minute.<\/p>\n<p>Next we use the following block of code to: 1) open the Web site stored in the variable strWebSite; 2) hide the address bar; and 3) make Internet Explorer visible on screen:<\/p>\n<pre class=\"codeSample\">objExplorer.Navigate strWebSite\nobjExplorer.AddressBar = 0\nobjExplorer.Visible = 1\n<\/pre>\n<p>Like we said, we couldn\u2019t find a startup switch that would hide the address bar. However, if we programmatically start Internet Explorer we can hide the address bar simply by setting the <b>AddressBar<\/b> property to 0. So that\u2019s what we did.<\/p>\n<p>In case you\u2019re interested, these lines of code hide the Internet Explorer toolbar and status bar, respectively:<\/p>\n<pre class=\"codeSample\">objExplorer.ToolBar = 0\nobjExplorer.StatusBar = 0\n<\/pre>\n<p>All of that makes up the script called by our Internet Explorer shortcut. Now, let\u2019s take a look at a second script, one that actually creates this shortcut:<\/p>\n<pre class=\"codeSample\">Set objShell = CreateObject(\"Wscript.Shell\")\nstrFolder = objShell.SpecialFolders.Item(\"Desktop\")\nSet objShortcut = objShell.CreateShortcut(strFolder &amp; \"\\Open Web Site.lnk\")\nobjShortcut.TargetPath = \"c:\\scripts\\test.vbs\"\nobjShortcut.Arguments = \"http:\/\/www.microsoft.com\/technet\/scriptcenter\"\nobjShortcut.Save\n<\/pre>\n<p>This is pretty simple little script, too. We start out by creating an instance of the <b>Wscript.Shell<\/b> object, the object used for creating shortcuts. Because we want this shortcut to appear on the desktop we then use this line of code to retrieve the path to the user\u2019s desktop folder:<\/p>\n<pre class=\"codeSample\">strFolder = objShell.SpecialFolders.Item(\"Desktop\")\n<\/pre>\n<p>With us so far? Good. Our next step is to create the shortcut, something we do using the aptly-named <b>CreateShortcut<\/b> method:<\/p>\n<pre class=\"codeSample\">Set objShortcut = objShell.CreateShortcut(strFolder &amp; \"\\Open Web Site.lnk\")\n<\/pre>\n<p>As you can see, all we need to do is pass CreateShortcut the file path for the new shortcut. Because we want this shortcut to appear on the desktop we create a path that combines the path to the desktop folder (a value stored in the variable strFolder), a \\, and the shortcut file name: <i>Open Web Site.lnk<\/i>. In other words, we\u2019re creating a shortcut with a path similar to this:<\/p>\n<pre class=\"codeSample\">C:\\Documents and Settings\\Ken Myer\\Desktop\\Open Web Site.lnk\n<\/pre>\n<p>Next we need to assign values to two properties: <b>TargetPath<\/b> and <b>Arguments<\/b>. The TargetPath is the script we want to call whenever we use the shortcut; in this case that\u2019s the script C:\\Scripts\\Test.vbs. The Arguments property, meanwhile, represents any command-line arguments that we want to pass to the script. Because we want this shortcut to open a link to the Script Center (<a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\">http:\/\/www.microsoft.com\/technet\/scriptcenter<\/a>) we assign the Script Center URL to the Arguments property.<\/p>\n<p>Finally, we call the <b>Save<\/b> method to officially save our new shortcut to the file system.<\/p>\n<p>Now for the exciting part: what\u2019s going to happen when we use this shortcut? Well, the shortcut will call C:\\Scripts\\Test.vbs, passing the Script Center URL as the first (and only) command-line argument. Test.vbs will:<\/p>\n<table class=\"numberedList\" cellSpacing=\"0\" cellPadding=\"0\" border=\"0\">\n<tbody>\n<tr vAlign=\"top\">\n<td class=\"listNumber\" noWrap align=\"right\">\n<p>1.<\/p>\n<\/td>\n<td class=\"\">\n<p>Create an instance of Internet Explorer.<\/p>\n<\/td>\n<\/tr>\n<tr vAlign=\"top\">\n<td class=\"listNumber\" noWrap align=\"right\">\n<p>2.<\/p>\n<\/td>\n<td class=\"\">\n<p>Use the Navigate method to open the Script Center URL.<\/p>\n<\/td>\n<\/tr>\n<tr vAlign=\"top\">\n<td class=\"listNumber\" noWrap align=\"right\">\n<p>3.<\/p>\n<\/td>\n<td class=\"\">\n<p>Hide the address bar.<\/p>\n<\/td>\n<\/tr>\n<tr vAlign=\"top\">\n<td class=\"listNumber\" noWrap align=\"right\">\n<p>4.<\/p>\n<\/td>\n<td class=\"\">\n<p>Appear on screen.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Give it a try and see for yourself.<\/p>\n<p>Or, alternatively, get a time machine, go back and time, and make sure that a startup switch that enables you to hide the address bar is added to Internet Explorer. Whichever way is easier for you is fine by us.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I create a shortcut that opens Internet Explorer with the address bar hidden? &#8212; WA Hey, WA. You know, any time a science fiction writer starts to run low on ideas he or she writes a story in which someone goes to bed and then wakes up in the morning [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[17,3,167,5],"class_list":["post-65853","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-internet-explorer","tag-scripting-guy","tag-using-the-internet","tag-vbscript"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I create a shortcut that opens Internet Explorer with the address bar hidden? &#8212; WA Hey, WA. You know, any time a science fiction writer starts to run low on ideas he or she writes a story in which someone goes to bed and then wakes up in the morning [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/65853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=65853"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/65853\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=65853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=65853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=65853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}