<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unable to parse speechmarks &amp;quot;&amp;quot; into powershell using RunProgram in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Unable-to-parse-speechmarks-quot-quot-into-powershell-using/m-p/245968#M48328</link>
    <description>&lt;P&gt;Just stumbled into a great explanation of the windows command line, quotation marks, escaping, and why it seems so hard.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.windowsinspired.com/the-correct-way-to-quote-command-line-arguments/" target="_blank" rel="noopener"&gt;http://www.windowsinspired.com/the-correct-way-to-quote-command-line-arguments/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.windowsinspired.com/understanding-the-command-line-string-and-arguments-received-by-a-windows-program/" target="_blank" rel="noopener"&gt;http://www.windowsinspired.com/understanding-the-command-line-string-and-arguments-received-by-a-windows-program/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/" target="_blank" rel="noopener"&gt;http://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Over-simplified: multiple arguments on a command line are separated by spaces. Each quotation mark toggles whether spaces are used to separate arguments. \\ is a literal \ and \" is a literal ". Two adjacent quotation marks when spaces are toggled off&amp;nbsp; results in a literal ", but the spaces may be toggled on or off depending on which parser variation is used.&lt;/P&gt;
&lt;P&gt;update 20jan2025: the links have gone stale, web archive versions:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://web.archive.org/web/20220629215303/http://windowsinspired.com/the-correct-way-to-quote-command-line-arguments/" target="_blank"&gt;http://web.archive.org/web/20220629215303/http://windowsinspired.com/the-correct-way-to-quote-command-line-arguments/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://web.archive.org/web/20220629212707/https://www.windowsinspired.com/understanding-the-command-line-string-and-arguments-received-by-a-windows-program/" target="_blank"&gt;https://web.archive.org/web/20220629212707/https://www.windowsinspired.com/understanding-the-command-line-string-and-arguments-received-by-a-windows-program/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://web.archive.org/web/20220629212422/https://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/" target="_blank"&gt;https://web.archive.org/web/20220629212422/https://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jan 2025 15:22:05 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2025-01-20T15:22:05Z</dc:date>
    <item>
      <title>Unable to parse speechmarks "" into powershell using RunProgram</title>
      <link>https://community.jmp.com/t5/Discussions/Unable-to-parse-speechmarks-quot-quot-into-powershell-using/m-p/219820#M43988</link>
      <description>&lt;P&gt;Hi, I'm having problems with Executing powershell, for example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cmd = EvalInsert(
"\[$imageFile = "test"]\");
						rp1 = RunProgram(Executable("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" ),
							Options(Eval(cmd)),
							ReadFunction("text")
						);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The actual cmd i want to use is more complex but has the same problem with speechmarks. Printing rp1 in the log gives:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;"test : The term 'test' is not recognized as the name of a cmdlet, function, script file, or operable program. Check 
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:14
+ $imageFile = test
+              ~~~~
    + CategoryInfo          : ObjectNotFound: (test:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
"&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Which implies the line was ran without speechmarks.&lt;/P&gt;&lt;P&gt;How would I ensure speechmarks are ran correctly?&lt;/P&gt;&lt;P&gt;Thanks in advance for any help on this.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 09:35:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Unable-to-parse-speechmarks-quot-quot-into-powershell-using/m-p/219820#M43988</guid>
      <dc:creator>david707</dc:creator>
      <dc:date>2019-08-02T09:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to parse speechmarks "" into powershell using RunProgram</title>
      <link>https://community.jmp.com/t5/Discussions/Unable-to-parse-speechmarks-quot-quot-into-powershell-using/m-p/219850#M43991</link>
      <description>&lt;P&gt;The command line argument needs some additional quotation marks and escaping to make the powershell command line parsing work. (This is the second time I've used powershell, I may be overlooking something...) (Also, this web page syntax coloring is wrong for the square bracket quoting escape.)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;command = "\["$imagefile = \"test\";echo $imagefile"]\";
Write( "\!nthe command is:", command ); // write shows it in the log without extra escapes
result = RunProgram(
	executable( "powershell.exe" ), //
	options( command ), //
	readfunction( "text" )//
);
Show( result );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;the command is:"$imagefile = \"test\";echo $imagefile"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;result = "test&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a screen capture of two tries I made in a CMD window.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="powershell output in a CMD window" style="width: 675px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/18545i3A22F38BEC796633/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="powershell output in a CMD window" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;powershell output in a CMD window&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The outer quotation marks make powershell see a single option; the outer quotation marks are removed by CMD before powershell gets the text. In your original example, there were three items&amp;nbsp;powershell received ($imagefile, =, test ) and the outer quotation marks around test were removed by CMD. The outer quotation marks are needed when there are quotation marks or spaces in the arguments.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 14:46:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Unable-to-parse-speechmarks-quot-quot-into-powershell-using/m-p/219850#M43991</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2019-08-02T14:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to parse speechmarks "" into powershell using RunProgram</title>
      <link>https://community.jmp.com/t5/Discussions/Unable-to-parse-speechmarks-quot-quot-into-powershell-using/m-p/245968#M48328</link>
      <description>&lt;P&gt;Just stumbled into a great explanation of the windows command line, quotation marks, escaping, and why it seems so hard.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.windowsinspired.com/the-correct-way-to-quote-command-line-arguments/" target="_blank" rel="noopener"&gt;http://www.windowsinspired.com/the-correct-way-to-quote-command-line-arguments/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.windowsinspired.com/understanding-the-command-line-string-and-arguments-received-by-a-windows-program/" target="_blank" rel="noopener"&gt;http://www.windowsinspired.com/understanding-the-command-line-string-and-arguments-received-by-a-windows-program/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/" target="_blank" rel="noopener"&gt;http://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Over-simplified: multiple arguments on a command line are separated by spaces. Each quotation mark toggles whether spaces are used to separate arguments. \\ is a literal \ and \" is a literal ". Two adjacent quotation marks when spaces are toggled off&amp;nbsp; results in a literal ", but the spaces may be toggled on or off depending on which parser variation is used.&lt;/P&gt;
&lt;P&gt;update 20jan2025: the links have gone stale, web archive versions:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://web.archive.org/web/20220629215303/http://windowsinspired.com/the-correct-way-to-quote-command-line-arguments/" target="_blank"&gt;http://web.archive.org/web/20220629215303/http://windowsinspired.com/the-correct-way-to-quote-command-line-arguments/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://web.archive.org/web/20220629212707/https://www.windowsinspired.com/understanding-the-command-line-string-and-arguments-received-by-a-windows-program/" target="_blank"&gt;https://web.archive.org/web/20220629212707/https://www.windowsinspired.com/understanding-the-command-line-string-and-arguments-received-by-a-windows-program/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://web.archive.org/web/20220629212422/https://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/" target="_blank"&gt;https://web.archive.org/web/20220629212422/https://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2025 15:22:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Unable-to-parse-speechmarks-quot-quot-into-powershell-using/m-p/245968#M48328</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2025-01-20T15:22:05Z</dc:date>
    </item>
  </channel>
</rss>

