<?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[ShellExecute und Batch-Datei mit Parametern (war: ShellExecute)]]></title><description><![CDATA[<p>Hi ich habe ine Prblem mit dem Befel ShellExecute ich will eine .bat Datei mit Attribute was mache ich falsch</p>
<pre><code class="language-cpp">AnsiString Temp1 = &quot;&quot; + Edit2-&gt;Text + Edit3-&gt;Text + &quot; &quot; + Edit2-&gt;Text + &quot;*.msg&quot;;
   char *ch = new char[Temp1.Length()+1];
   strcpy(ch, Temp1.c_str());
   ShellExecute(0,&quot;open&quot;,&quot;\Copy2.bat&quot;,ch,0,SW_SHOWNORMAL);
</code></pre>
<p>Das ist der Inhalt der .bat Datei wer einen Vorschlag hat wie mann das in C++ losen kann ich bin für vorschläge offen</p>
<pre><code>@echo off
C:\Programme\WinRAR\RAR.exe A &quot;%1&quot; &quot;%2&quot;
del %2
</code></pre>
<p><strong>Edit:</strong><br />
Bitte aussagekräftige Überschriften wählen. Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/118906/shellexecute-und-batch-datei-mit-parametern-war-shellexecute</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Jul 2026 03:39:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/118906.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 25 Aug 2005 13:48:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ShellExecute und Batch-Datei mit Parametern (war: ShellExecute) on Thu, 25 Aug 2005 18:20:53 GMT]]></title><description><![CDATA[<p>Hi ich habe ine Prblem mit dem Befel ShellExecute ich will eine .bat Datei mit Attribute was mache ich falsch</p>
<pre><code class="language-cpp">AnsiString Temp1 = &quot;&quot; + Edit2-&gt;Text + Edit3-&gt;Text + &quot; &quot; + Edit2-&gt;Text + &quot;*.msg&quot;;
   char *ch = new char[Temp1.Length()+1];
   strcpy(ch, Temp1.c_str());
   ShellExecute(0,&quot;open&quot;,&quot;\Copy2.bat&quot;,ch,0,SW_SHOWNORMAL);
</code></pre>
<p>Das ist der Inhalt der .bat Datei wer einen Vorschlag hat wie mann das in C++ losen kann ich bin für vorschläge offen</p>
<pre><code>@echo off
C:\Programme\WinRAR\RAR.exe A &quot;%1&quot; &quot;%2&quot;
del %2
</code></pre>
<p><strong>Edit:</strong><br />
Bitte aussagekräftige Überschriften wählen. Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/858345</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/858345</guid><dc:creator><![CDATA[Werner2005]]></dc:creator><pubDate>Thu, 25 Aug 2005 18:20:53 GMT</pubDate></item><item><title><![CDATA[Reply to ShellExecute und Batch-Datei mit Parametern (war: ShellExecute) on Thu, 25 Aug 2005 13:57:44 GMT]]></title><description><![CDATA[<p>Du brauchst den String nicht zu kopieren, sondern einfach die Methode &quot;c_str()&quot; aufrufen:</p>
<pre><code class="language-cpp">AnsiString Temp1 = Edit2-&gt;Text + Edit3-&gt;Text + &quot; &quot; + Edit2-&gt;Text + &quot;*.msg&quot;;
ShellExecute(0,&quot;open&quot;,&quot;Copy2.bat&quot;,Templ.c_str(),0,SW_SHOWNORMAL);
</code></pre>
<p>Außerdem ist &quot;\C&quot; falsch, wenn die Batch-Datei im aktuellen Verzeichnis liegt (dies kann sich im Programm natürlich ändern), dann einfach &quot;Copy.bat&quot; oder auch &quot;.\\Copy.bat&quot; (\ muß maskiert werden!)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/858358</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/858358</guid><dc:creator><![CDATA[Th]]></dc:creator><pubDate>Thu, 25 Aug 2005 13:57:44 GMT</pubDate></item><item><title><![CDATA[Reply to ShellExecute und Batch-Datei mit Parametern (war: ShellExecute) on Thu, 25 Aug 2005 13:59:32 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>wenn die Batch-Datei im selben Verzeichnis wie das Programm ist</p>
<pre><code class="language-cpp">ShellExecute(0,&quot;open&quot;,&quot;Copy2.bat&quot;,Templ.c_str(),0,SW_SHOWNORMAL);
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/858361</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/858361</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Thu, 25 Aug 2005 13:59:32 GMT</pubDate></item><item><title><![CDATA[Reply to ShellExecute und Batch-Datei mit Parametern (war: ShellExecute) on Thu, 25 Aug 2005 14:04:05 GMT]]></title><description><![CDATA[<p>Man könnte das mit der Batchdatei auch lassen und RAR direkt über ShellExecute aufrufen und dann die Datei mit DeleteFile löschen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/858368</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/858368</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 25 Aug 2005 14:04:05 GMT</pubDate></item><item><title><![CDATA[Reply to ShellExecute und Batch-Datei mit Parametern (war: ShellExecute) on Thu, 25 Aug 2005 14:23:25 GMT]]></title><description><![CDATA[<p>hi die .bat Datei wird nicht aufgerufen fileicht fidet ihr einen Fehelr in dem Eingentlichen Code</p>
<pre><code class="language-cpp">void __fastcall TForm1::Button1Click(TObject *Sender)
{
  TSearchRec sr;
  int iAttributes = 0;
  StringGrid1-&gt;RowCount = 1;
  iAttributes |= faReadOnly * CheckBox1-&gt;Checked;
  iAttributes |= faHidden * CheckBox2-&gt;Checked;
  iAttributes |= faSysFile * CheckBox3-&gt;Checked;
  iAttributes |= faVolumeID * CheckBox4-&gt;Checked;
  iAttributes |= faDirectory * CheckBox5-&gt;Checked;
  iAttributes |= faArchive * CheckBox6-&gt;Checked; 
  iAttributes |= faAnyFile * CheckBox7-&gt;Checked; 
  StringGrid1-&gt;RowCount = 0;
  int Fehler = 0;
  if(CheckBox8-&gt;Checked == true)
  {
  Memo1-&gt;Lines-&gt;Add(&quot;Detaliret Auflistung der Kopierten Darteien\n&quot;);
 // Memo1-&gt;Lines-&gt;Add(&quot;\nVom&quot; + DateToStr(Date));
  }
  CheckBox8-&gt;Enabled = false;
  DateTimePicker1-&gt;Enabled = false;
  DateTimePicker2-&gt;Enabled = false;
  Button1-&gt;Enabled = false;
  Edit1-&gt;Enabled = false;
  Edit2-&gt;Enabled = false;
  DriveComboBox1-&gt;Enabled = false;
  DriveComboBox2-&gt;Enabled = false;
  DirectoryListBox1-&gt;Enabled = false;
  DirectoryListBox2-&gt;Enabled = false;
  Button2-&gt;Enabled = false;
  Button1-&gt;Caption = &quot;Dateien werden Kopiert ...&quot; ;
  if (FindFirst(Edit1-&gt;Text, iAttributes, sr) == 0)

  { 

    do 
    {
      if ((sr.Attr &amp; iAttributes) == sr.Attr) 
      { 

        StringGrid1-&gt;RowCount = StringGrid1-&gt;RowCount + 1; 
        StringGrid1-&gt;Cells[1][StringGrid1-&gt;RowCount-1] = sr.Name; 
        StringGrid1-&gt;Cells[2][StringGrid1-&gt;RowCount-1] = IntToStr(sr.Size); 
        StringGrid1-&gt;Cells[3][StringGrid1-&gt;RowCount-1] = sr.Time; 
        TDateTime TempTime = FileDateToDateTime(sr.Time) ;
        if(TempTime &gt;= DateTimePicker1-&gt;DateTime-1 &amp;&amp; TempTime &lt;= DateTimePicker2-&gt;DateTime)
         { 
           StringGrid1-&gt;Cells[3][StringGrid1-&gt;RowCount-1] = &quot;richtig&quot;;
           AnsiString Temp1 = DirectoryListBox1-&gt;Directory + Label7-&gt;Caption + sr.Name;
           if(sr.Name == &quot;.&quot; || sr.Name == &quot;..&quot;)
            {
            StringGrid1-&gt;Cells[3][StringGrid1-&gt;RowCount-1] = &quot;falsch&quot; ;
            }
            else
            {
             if(!MoveFiles(Temp1, Edit2-&gt;Text))
              {
              if(CheckBox8-&gt;Checked == true)
              {
               Memo1-&gt;Lines-&gt;Add(&quot;Die Datei &quot; + sr.Name + &quot; wurde erfolgreich nach &quot; + DirectoryListBox1-&gt;Directory + &quot; kopiert\n&quot;);
              }
              }
             else
              {
                StringGrid1-&gt;Cells[3][StringGrid1-&gt;RowCount-1] = &quot;Fehler&quot; ;
                Fehler++;
              if(CheckBox8-&gt;Checked == true)
              {
               Memo1-&gt;Lines-&gt;Add(&quot;Die Datei &quot; + sr.Name + &quot; wurde nicht erfolgreich nach &quot; + DirectoryListBox1-&gt;Directory + &quot; kopiert\n&quot;);
              }
              }
            }

         }
         else
         {
          StringGrid1-&gt;Cells[3][StringGrid1-&gt;RowCount-1] = &quot;falsch&quot; ;
         }

      }
    } while (FindNext(sr) == 0);
    FindClose(sr);
  if(CheckBox9-&gt;Checked == true)
  {
//   AnsiString Temp1 = Label17-&gt;Caption + Label19-&gt;Caption + &quot;a df &quot; + Label17-&gt;Caption + DirectoryListBox1-&gt;Directory + Label7-&gt;Caption + Edit3-&gt;Text + Label17-&gt;Caption + &quot; &quot; + Label17-&gt;Caption + Edit2-&gt;Text + &quot;*.msg&quot; + Label17-&gt;Caption + Label17-&gt;Caption;
   AnsiString Temp1 = Edit2-&gt;Text + Edit3-&gt;Text + &quot; &quot; + Edit2-&gt;Text + &quot;*.msg&quot;;
   ShellExecute(0,&quot;open&quot;,&quot;Copy2.bat&quot;,Temp1.c_str(),0,SW_SHOWNORMAL);
  }
    if(Fehler != 0)
    {
     ShowMessage(&quot;Fehler aufgetreten !&quot;);
    }
    else
     {
      ShowMessage(&quot;Fertig&quot;);
     }
  }

  CheckBox8-&gt;Enabled = true;
  DateTimePicker1-&gt;Enabled = true;
  DateTimePicker2-&gt;Enabled = true;
  Button1-&gt;Enabled = true;
  Edit1-&gt;Enabled = true;
  Edit2-&gt;Enabled = true;
  DriveComboBox1-&gt;Enabled = true;
  DriveComboBox2-&gt;Enabled = true;
  DirectoryListBox1-&gt;Enabled = true;
  DirectoryListBox2-&gt;Enabled = true;
  Button2-&gt;Enabled = true;
  Button1-&gt;Caption = &quot;Dateien Kopieren&quot; ;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/858388</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/858388</guid><dc:creator><![CDATA[Werner2005]]></dc:creator><pubDate>Thu, 25 Aug 2005 14:23:25 GMT</pubDate></item><item><title><![CDATA[Reply to ShellExecute und Batch-Datei mit Parametern (war: ShellExecute) on Fri, 26 Aug 2005 08:31:12 GMT]]></title><description><![CDATA[<p>Evtl. mußt du dir bei Programmstart das aktuelle Verzeichnis (bzw. das Verzeichnis der EXE) merken und dann vor den Namen der Batch-Datei hängen.</p>
<p>schau mal nach:<br />
- Application.ExeName<br />
- ExtractFilePath(...)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/858805</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/858805</guid><dc:creator><![CDATA[Th]]></dc:creator><pubDate>Fri, 26 Aug 2005 08:31:12 GMT</pubDate></item></channel></rss>