{"id":69613,"date":"2005-06-13T11:09:00","date_gmt":"2005-06-13T11:09:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2005\/06\/13\/how-can-i-change-the-size-of-the-temporary-internet-files-folder\/"},"modified":"2005-06-13T11:09:00","modified_gmt":"2005-06-13T11:09:00","slug":"how-can-i-change-the-size-of-the-temporary-internet-files-folder","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-change-the-size-of-the-temporary-internet-files-folder\/","title":{"rendered":"How Can I Change the Size of the Temporary Internet Files Folder?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"> \n<P>Hey, Scripting Guy! How can I change the amount of disk space set aside for Internet Explorer\u2019s temporary files folder?<BR><BR>&#8212; AD<\/P><IMG border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/A> \n<P>Hey, AD. The first draft of this column we were able to bang out in no time; after all, it consisted entirely of this:<\/P>\n<P>Beats us.<\/P>\n<P>But after discussing how valuable an answer like that would be to our customers, and after realizing that this is the month when we\u2019re supposed to write up our performance reviews, we decided maybe we\u2019d look into this a little further. And although it took a little bit of research, we were able to come up with an answer. (Something you can bet we\u2019ll feature very prominently on our performance review, right after the note that, \u201cAt least this year we didn\u2019t set anything on fire.\u201d Between those two items, this might be our best review yet.)<\/P>\n<P>In case you aren\u2019t sure what AD is referring to, start up Internet Explorer and select <B>Internet Options<\/B> from the <B>Tools<\/B> menu. In the <B>Internet Options<\/B> dialog box, on the <B>General<\/B> tab, click <B>Settings<\/B>. You should see a dialog box similar to this:<\/P><IMG border=\"0\" alt=\"Internet Explorer\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/qanda\/cache1.jpg\" width=\"354\" height=\"357\"> \n<P><BR>What AD would like to do is write a script that can change the <B>Amount of disk space to use<\/B> value (which, in this example, is set to 447 MB). We have good news for you, AD. You don\u2019t have to write this script; we\u2019ve already written it for you:<\/P><PRE class=\"codeSample\">Const HKEY_CURRENT_USER = &amp;H80000001<\/p>\n<p>strComputer = &#8220;.&#8221;<\/p>\n<p>Set objRegistry = GetObject(&#8220;winmgmts:\\\\&#8221; &amp; strComputer &amp; &#8220;\\root\\default:StdRegProv&#8221;)<\/p>\n<p>strKeyPath = &#8220;SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\5.0\\Cache\\Content&#8221;\nstrValueName = &#8220;CacheLimit&#8221;\ndwValue = 358400\nobjRegistry.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue<\/p>\n<p>strKeyPath = &#8220;SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Cache\\Content&#8221;\nstrValueName = &#8220;CacheLimit&#8221;\ndwValue = 358400\nobjRegistry.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue\n<\/PRE>\n<P>As it turns out, the amount of disk space set aside for temporary Internet files is regulated by two registry values:<\/P>\n<TABLE border=\"0\" cellSpacing=\"0\" cellPadding=\"0\">\n<TBODY>\n<TR>\n<TD class=\"listBullet\" vAlign=\"top\">\u2022<\/TD>\n<TD class=\"listItem\">\n<P>HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\5.0\\Cache\\Content\\CacheLimit<\/P><\/TD><\/TR>\n<TR>\n<TD class=\"listBullet\" vAlign=\"top\">\u2022<\/TD>\n<TD class=\"listItem\">\n<P>HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Cache\\Content\\CacheLimit<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<P>To change the size from 447 MB all we have to do is change the value of these two registry entries.<\/P>\n<P>And that\u2019s exactly what our script does. The script begins by defining a constant named HKEY_CURRENT_USER and setting the value to &amp;H80000001; we\u2019ll use that later on to tell the script that we want to work with the HKEY_CURRENT_USER portion of the registry. We then connect to the WMI service on the local computer, and, more specifically, to the <B>StdRegProv<\/B> class.<\/P>\n<P>The next three lines of code are used to assign values to three different variables:<\/P><PRE class=\"codeSample\">strKeyPath = &#8220;SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\5.0\\Cache\\Content&#8221;\nstrValueName = &#8220;CacheLimit&#8221;\ndwValue = 358400\n<\/PRE>\n<P>The variable strKeyPath represents the path within the HKEY_CURRENT_USER portion of the registry; strValueName represents the registry value we want to change (in this case, CacheLimit). We use the variable dwValue to indicate the new size for the Temporary Internet Files folder. It\u2019s important to note that, although the disk space amount is shown in megabytes in the Internet Explorer UI, the value stored in the registry is stored as kilobytes. That means we need to do a little math here. For example, suppose we want to set the disk space amount to 350 megabtes. In that case, we must multiply 350 by 1024; that will give us 358400 kilobytes. And <I>that\u2019s<\/I> the value we assign to the variable dwValue. To set aside 238 megabytes multiply 238 by 1024 and assign <I>that<\/I> value (243712) to dwValue.<\/P>\n<P>To actually change the value in the registry all we have to do is call the <B>SetDWORDValue<\/B> method, passing the appropriate variables as parameters:<\/P><PRE class=\"codeSample\">objRegistry.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue\n<\/PRE>\n<P>We then repeat the process for the second registry value. The next time you start Internet Explorer you should see that the amount of disk space set aside for temporary Internet files has changed:<\/P><IMG border=\"0\" alt=\"Internet Explorer\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/qanda\/cache2.jpg\" width=\"354\" height=\"357\"> \n<P><BR>Now if only we could write a script that would go in and change our performance review scores as easily as this script changes the Internet Explorer cache size\u2026.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I change the amount of disk space set aside for Internet Explorer\u2019s temporary files folder?&#8212; AD Hey, AD. The first draft of this column we were able to bang out in no time; after all, it consisted entirely of this: Beats us. But after discussing how valuable an answer like [&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-69613","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 change the amount of disk space set aside for Internet Explorer\u2019s temporary files folder?&#8212; AD Hey, AD. The first draft of this column we were able to bang out in no time; after all, it consisted entirely of this: Beats us. But after discussing how valuable an answer like [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69613","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=69613"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69613\/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=69613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=69613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=69613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}