<div dir="ltr">Ugh. Even under Windows, doesn't<div><br></div><div><span style="color:rgb(80,0,80);font-size:12.8px">$cmd = "./psexec.exe //" . $server_name</span><br></div><div><span style="color:rgb(80,0,80);font-size:12.8px"><br></span></div><div><span style="color:rgb(80,0,80);font-size:12.8px">work the same? Is there any need to use backslashes here?</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 12, 2016 at 1:53 PM, Gilbert E. Detillieux <span dir="ltr"><<a href="mailto:gedetil@cs.umanitoba.ca" target="_blank">gedetil@cs.umanitoba.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yup, makes sense now...<br>
<br>
After this line...<span class=""><br>
<br>
$cmd = "./psexec.exe \\\\\\\\" . $server_name<br>
<br></span>
... the cmd variable will contain "./psexec.exe \\\\server" (4 backslashes. On running this line...<br>
<br>
my $output = `$cmd`<br>
<br>
... the shell will see "./psexec.exe \\\\server", and the command will see (after shell quote processing) argv[1] set to "\\server".<br>
<br>
Each level of "\" escape processing requires that you double the number of "\" characters entered to get one through. If you want to end up with 2, after 2 levels, you need 8.<br>
<br>
Gilbert<span class=""><br>
<br>
On 12/12/2016 1:43 PM, Kevin McGregor wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
I should add that this gets run immediately after via<br>
<br>
my $output = `$cmd`<br>
<br>
if that makes any difference.<br>
<br>
On Mon, Dec 12, 2016 at 1:40 PM, Kevin McGregor<br></span><span class="">
<<a href="mailto:kevin.a.mcgregor@gmail.com" target="_blank">kevin.a.mcgregor@gmail.com</a> <mailto:<a href="mailto:kevin.a.mcgregor@gmail.com" target="_blank">kevin.a.mcgregor@gmail<wbr>.com</a>>> wrote:<br>
<br>
I'm trying to decipher some Perl code which runs on a Windows<br>
server, and I ran into this:<br>
<br>
$cmd = "./psexec.exe \\\\\\\\" . $server_name<br>
<br>
I think the idea is to end up with<br>
<br>
./psexec.exe \\server<br>
<br>
but WTF eight backslashes? Does that make any sense? If so, can<br>
someone ELI5?<br>
<br>
Kevin<br>
</span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
-- <br>
Gilbert E. Detillieux E-mail: <<a href="mailto:gedetil@cs.umanitoba.ca" target="_blank">gedetil@cs.umanitoba.ca</a>><br>
Dept. of Computer Science Web: <a href="http://www.cs.umanitoba.ca/~gedetil/" rel="noreferrer" target="_blank">http://www.cs.umanitoba.ca/~ge<wbr>detil/</a><br>
University of Manitoba Phone: <a href="tel:%28204%29474-8161" value="+12044748161" target="_blank">(204)474-8161</a><br>
Winnipeg MB CANADA R3T 2N2 Fax: <a href="tel:%28204%29474-7609" value="+12044747609" target="_blank">(204)474-7609</a><br>
______________________________<wbr>_________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.ca" target="_blank">Roundtable@muug.ca</a><br>
<a href="https://muug.ca/mailman/listinfo/roundtable" rel="noreferrer" target="_blank">https://muug.ca/mailman/listin<wbr>fo/roundtable</a><br>
</font></span></blockquote></div><br></div>