<div dir="ltr">Salve a tutti,<div>ho la necessita di eseguire un comando dnscmd da python, sto provando con subprocess ma senza risultato. Vi posto lo script di partenza:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px">
<div class="" id="LC44" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;color:rgb(51,51,51);padding-left:10px"><span class="">import subprocess</span></div><div class="" id="LC44" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;color:rgb(51,51,51);padding-left:10px">
<span class="">output</span> <span class="" style="font-weight:bold">=</span> <span class="">subprocess</span><span class="" style="font-weight:bold">.</span><span class="">Popen</span><span class="">(</span><span class="" style="color:rgb(221,17,68)">'"C:\Windows\System32\dnscmd.exe" /EnumZones'</span><span class="">,</span> <span class="">shell</span><span class="" style="font-weight:bold">=</span><span class="" style="color:rgb(153,153,153)">True</span><span class="">,</span> <span class="">stdout</span><span class="" style="font-weight:bold">=</span><span class="">subprocess</span><span class="" style="font-weight:bold">.</span><span class="">PIPE</span><span class="">,</span> <span class="">stderr</span><span class="" style="font-weight:bold">=</span><span class="">subprocess</span><span class="" style="font-weight:bold">.</span><span class="">PIPE</span><span class="">)</span></div>
<div class="" id="LC45" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;color:rgb(51,51,51);padding-left:10px"><span class="">out</span><span class="">,</span> <span class="">err</span> <span class="" style="font-weight:bold">=</span> <span class="">output</span><span class="" style="font-weight:bold">.</span><span class="">communicate</span><span class="">()</span></div>
<div class="" id="LC46" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span class=""><font color="#333333">print</font></span><span class="" style="color:rgb(51,51,51)">(err</span><span class="" style="color:rgb(51,51,51)">)</span></div>
<div class="" id="LC46" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><br></div><div class="" id="LC46" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">
<br></div>Grazie.</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Marco P.</pre></div></div>