<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How Can I Pass Command-Line Variables to an HTA When It Starts?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/04/20/how-can-i-pass-command-line-variables-to-an-hta-when-it-starts.aspx</link><description>Hey, Scripting Guy! How can I pass command-line variables to an HTA when it starts? -- DM 
 Hey, DM. Ok, we admit it: you almost had us on this one. (Not that being able to stump the Scripting Guys is particularly hard, mind you.) We had no idea whether</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How Can I Pass Command-Line Variables to an HTA When It Starts?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/04/20/how-can-i-pass-command-line-variables-to-an-hta-when-it-starts.aspx#3473400</link><pubDate>Fri, 30 Dec 2011 12:45:59 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3473400</guid><dc:creator>HTA_hacker</dc:creator><description>&lt;p&gt;@Steve&lt;/p&gt;
&lt;p&gt;That&amp;#39;s not too difficult: TardisRepairMan&amp;#39;s solution removes the first quoted string ONLY (which is the app startup path\name). After that you can parse the remaining arguments in any manner you wish, including checking for quotes paths if these are expected.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3473400" width="1" height="1"&gt;</description></item><item><title>re: How Can I Pass Command-Line Variables to an HTA When It Starts?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/04/20/how-can-i-pass-command-line-variables-to-an-hta-when-it-starts.aspx#3448595</link><pubDate>Tue, 23 Aug 2011 09:58:28 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3448595</guid><dc:creator>Steve</dc:creator><description>&lt;p&gt;What if one of the parameters is a filepath+filename and has a space in it?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3448595" width="1" height="1"&gt;</description></item><item><title>re: How Can I Pass Command-Line Variables to an HTA When It Starts?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/04/20/how-can-i-pass-command-line-variables-to-an-hta-when-it-starts.aspx#3419528</link><pubDate>Thu, 07 Apr 2011 17:11:16 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3419528</guid><dc:creator>TardisRepairMan</dc:creator><description>&lt;p&gt;When handling command line parameters in HTAs, surely it would be better to make them work in the same way as other command line utils?&lt;/p&gt;
&lt;p&gt;&amp;quot;Yes it would. And don&amp;#39;t call me Shirley!&amp;quot; :-)&lt;/p&gt;
&lt;p&gt;To avoid all the quotes business, simpley select the part of the command line after the second quote.&lt;/p&gt;
&lt;p&gt;(&amp;quot;&amp;quot;&amp;quot;&amp;quot; &amp;nbsp;is a method of describing a single quote as a literal string.)&lt;/p&gt;
&lt;p&gt;code&lt;/p&gt;
&lt;p&gt;------&lt;/p&gt;
&lt;p&gt;&amp;lt;html&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;head&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;HTA:APPLICATION&lt;/p&gt;
&lt;p&gt; &amp;nbsp;APPLICATIONNAME=&amp;quot;Show Command Line&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;ID=&amp;quot;commandlineparams&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;VERSION=&amp;quot;1.0&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/head&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;script language=&amp;quot;VBScript&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;Dim strCommandLine,strParams,strParam,arrParams&lt;/p&gt;
&lt;p&gt;Sub Window_OnLoad&lt;/p&gt;
&lt;p&gt;	strCommandLine=commandlineparams.commandline&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#39; start at character 2 to avoid the first quote&lt;/p&gt;
&lt;p&gt;	strParams=Right(strCommandLine,Len(strCommandLine)-InStr(2,strCommandLine,&amp;quot;&amp;quot;&amp;quot;&amp;quot;,0))&lt;/p&gt;
&lt;p&gt;	arrParams=Split(strParams,&amp;quot; &amp;quot;)&lt;/p&gt;
&lt;p&gt;	For Each strParam In arrParams&lt;/p&gt;
&lt;p&gt;		If strParam =&amp;quot;&amp;quot; Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#39;empty string, don&amp;#39;t do anything! &lt;/p&gt;
&lt;p&gt;		Else&lt;/p&gt;
&lt;p&gt;		 &amp;nbsp; &amp;nbsp;results.value=results.value &amp;amp; strParam &amp;amp; vbcrlf&lt;/p&gt;
&lt;p&gt;		End If&lt;/p&gt;
&lt;p&gt;	Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;#39;This method will be called when the application loads&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;#39;Add your code here&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;body bgcolor=&amp;quot;white&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;!--Add your controls here--&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;textarea name=&amp;quot;results&amp;quot; id=&amp;quot;results&amp;quot; rows=&amp;quot;5&amp;quot; cols=&amp;quot;100&amp;quot;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;!--{{InsertControlsHere}}-Do not remove this line--&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/body&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3419528" width="1" height="1"&gt;</description></item></channel></rss>