<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Befehle im Hintergrund ausführen?]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich würde gerne ein paar externe Befehle im Hintergrund ausführen.</p>
<pre><code class="language-cpp">system (&quot;dir&quot;);
CreateProcess( NULL,   // No module name (use command line)
        &quot;dir&quot;,        // Command line
        NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        0,              // No creation flags
        NULL,           // Use parent's environment block
        NULL,           // Use parent's starting directory 
        &amp;si,            // Pointer to STARTUPINFO structure
        &amp;pi )
</code></pre>
<p>Helfen mir da nicht wirklich, denn es &quot;poppt&quot; immer ein Konsolenfenster auf, was für den Programmfluss natürlich sehr lästig und unschön ist. Gibt es keine Möglichkeit, dass ich Befehle im Hintergrund ausführen kann, so dass der User nicht durch aufpoppende Konsolenfenster genervt wird?</p>
<p>Danke für die Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/230575/befehle-im-hintergrund-ausführen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 21:58:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/230575.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 Dec 2008 10:44:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Befehle im Hintergrund ausführen? on Mon, 29 Dec 2008 10:44:23 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich würde gerne ein paar externe Befehle im Hintergrund ausführen.</p>
<pre><code class="language-cpp">system (&quot;dir&quot;);
CreateProcess( NULL,   // No module name (use command line)
        &quot;dir&quot;,        // Command line
        NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        0,              // No creation flags
        NULL,           // Use parent's environment block
        NULL,           // Use parent's starting directory 
        &amp;si,            // Pointer to STARTUPINFO structure
        &amp;pi )
</code></pre>
<p>Helfen mir da nicht wirklich, denn es &quot;poppt&quot; immer ein Konsolenfenster auf, was für den Programmfluss natürlich sehr lästig und unschön ist. Gibt es keine Möglichkeit, dass ich Befehle im Hintergrund ausführen kann, so dass der User nicht durch aufpoppende Konsolenfenster genervt wird?</p>
<p>Danke für die Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1636759</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1636759</guid><dc:creator><![CDATA[cmdliner]]></dc:creator><pubDate>Mon, 29 Dec 2008 10:44:23 GMT</pubDate></item><item><title><![CDATA[Reply to Befehle im Hintergrund ausführen? on Mon, 29 Dec 2008 11:10:41 GMT]]></title><description><![CDATA[<p>dir ist nunmal ein consolenprogramm.<br />
aber warum ließt du das verzeichnis nicht mit winapi befehlen aus, anstatt auf ein externes Programm zuzugreifen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1636764</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1636764</guid><dc:creator><![CDATA[vlad_tepesch]]></dc:creator><pubDate>Mon, 29 Dec 2008 11:10:41 GMT</pubDate></item><item><title><![CDATA[Reply to Befehle im Hintergrund ausführen? on Mon, 29 Dec 2008 11:14:04 GMT]]></title><description><![CDATA[<p>wie würde das mit winapi befehlen aussehen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1636765</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1636765</guid><dc:creator><![CDATA[cmdliner]]></dc:creator><pubDate>Mon, 29 Dec 2008 11:14:04 GMT</pubDate></item><item><title><![CDATA[Reply to Befehle im Hintergrund ausführen? on Mon, 29 Dec 2008 12:18:42 GMT]]></title><description><![CDATA[<p>FindFirstFile<br />
FindNextFile</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1636795</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1636795</guid><dc:creator><![CDATA[vlad_tepesch]]></dc:creator><pubDate>Mon, 29 Dec 2008 12:18:42 GMT</pubDate></item><item><title><![CDATA[Reply to Befehle im Hintergrund ausführen? on Mon, 29 Dec 2008 13:09:04 GMT]]></title><description><![CDATA[<p>also ich hab es jetzt nicht getestet, ob die konsole die durch System(&quot;dir&quot;) aufgerufen wird, nicht aufpopt, aber</p>
<p>über createprocess kannst du startparameter übergeben, die das weis ich sicher den zu startenden process beeinflussen. unter anderem eben auch ob der zu startende process als Fenster angezeigt wird oder nicht.<br />
versuch es mal so,</p>
<pre><code>STARTUPINFO sInfo;
ZeroMemory(&amp;sInfo,sizeof(sInfo));
sInfo.cb	= sizeof(sInfo);
sInfo.dwFlags = STARTF_USESHOWWINDOW;//Flag Damit das Mitglied von STARTUPINFO wShowWindow genutzt werden kann
sInfo.wShowWindow	= SW_HIDE;//Zeigt Fenster an oder nichtSW_SHOW 

system (&quot;dir&quot;);
CreateProcess( NULL,   // No module name (use command line)
        &quot;dir&quot;,        // Command line
        NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        0,              // No creation flags
        NULL,           // Use parent's environment block
        NULL,           // Use parent's starting directory 
        &amp;sInfo,            // Pointer to STARTUPINFO structure
        &amp;pi );
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1636821</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1636821</guid><dc:creator><![CDATA[*rT*f*Ct]]></dc:creator><pubDate>Mon, 29 Dec 2008 13:09:04 GMT</pubDate></item><item><title><![CDATA[Reply to Befehle im Hintergrund ausführen? on Mon, 29 Dec 2008 14:15:20 GMT]]></title><description><![CDATA[<p>pi wird nicht erkannt weil nicht definiert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1636855</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1636855</guid><dc:creator><![CDATA[cmdliner]]></dc:creator><pubDate>Mon, 29 Dec 2008 14:15:20 GMT</pubDate></item><item><title><![CDATA[Reply to Befehle im Hintergrund ausführen? on Mon, 29 Dec 2008 14:16:59 GMT]]></title><description><![CDATA[<p>Habs jetzt so umgebastelt:</p>
<pre><code class="language-cpp">int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{

    STARTUPINFO sInfo;
    PROCESS_INFORMATION pi;
ZeroMemory(&amp;sInfo,sizeof(sInfo));
sInfo.cb    = sizeof(sInfo);
ZeroMemory( &amp;pi, sizeof(pi) );
sInfo.dwFlags = STARTF_USESHOWWINDOW;//Flag Damit das Mitglied von STARTUPINFO wShowWindow genutzt werden kann
sInfo.wShowWindow    = SW_HIDE;//Zeigt Fenster an oder nichtSW_SHOW

system (&quot;dir&quot;);
CreateProcess( NULL,   // No module name (use command line)
        &quot;&quot;,        // Command line
        NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        0,              // No creation flags
        NULL,           // Use parent's environment block
        NULL,           // Use parent's starting directory
        &amp;sInfo,            // Pointer to STARTUPINFO structure
        &amp;pi );

    // Wait until child process exits.
    WaitForSingleObject( pi.hProcess, INFINITE );

    // Close process and thread handles. 
    CloseHandle( pi.hProcess );
    CloseHandle( pi.hThread );

}
</code></pre>
<p>=&gt; Das Konsolenfenster kommt leider immer noch <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1636857</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1636857</guid><dc:creator><![CDATA[cmdliner]]></dc:creator><pubDate>Mon, 29 Dec 2008 14:16:59 GMT</pubDate></item><item><title><![CDATA[Reply to Befehle im Hintergrund ausführen? on Mon, 29 Dec 2008 14:51:39 GMT]]></title><description><![CDATA[<p>was eigendlich auch kein wunder ist, denn du übergibst ja an lpApplicationName = NULL.</p>
<p>laut msdn ruft der befehl system die cmd.exe im system32 ordner auf.<br />
also setzt mal unter lpApplicationName die Pfadangabe anstatt NULL.</p>
<pre><code>CreateProcess( &quot;C:\\WINDOWS\\system32\\cmd.exe&quot;,   
&quot;dir&quot;, 
...
</code></pre>
<p>und verzichte auf den aufruf system(&quot;dir&quot;) denn das erledigst du jetzt mit createprocess</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1636881</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1636881</guid><dc:creator><![CDATA[*rT*f*Ct]]></dc:creator><pubDate>Mon, 29 Dec 2008 14:51:39 GMT</pubDate></item><item><title><![CDATA[Reply to Befehle im Hintergrund ausführen? on Tue, 30 Dec 2008 07:58:03 GMT]]></title><description><![CDATA[<p>Probier mal, CreateProcess mit DETACHED_PROCESS als creation flag aufzurufen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1637158</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1637158</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Tue, 30 Dec 2008 07:58:03 GMT</pubDate></item><item><title><![CDATA[Reply to Befehle im Hintergrund ausführen? on Tue, 30 Dec 2008 08:55:33 GMT]]></title><description><![CDATA[<p>Konsolenfenster werden auch nicht geöffnet wenn die entsprechende Input und Output Pipes umgelenkt werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1637168</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1637168</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 30 Dec 2008 08:55:33 GMT</pubDate></item></channel></rss>