<?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[ein script mit Parametern ausführen lassen]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich möchte gerne ein Script mit zusatzparametern in meinem Projekt ausführen.<br />
Zusätzlich soll das Script mit einem besonderen Benutzrecht ausgeführt werden.</p>
<p>Mit der Umwandlung von WCHAR nach std string was den Kommand des aufrufes der .bat Datei beinhaltet, gibt es probleme.....</p>
<p>Wie wandle ich das um ??</p>
<p>Hier der Source</p>
<pre><code class="language-cpp">std::string m_strEinPfad2 = &quot;c:\test.bat&quot;;
std::string SchluesselPfad = &quot;TEST&quot;;
std::string SchluesselName = &quot;Schluessel&quot;;
std::string strErgebnis = &quot;1&quot;;
std::string SchluesselWert = &quot;2&quot;;

m_strStartProgramm =  m_strEinPfad2 + &quot; &quot; +  + &quot; &quot; +  SchluesselPfad + &quot; &quot; + SchluesselName + &quot; &quot; + m_strErgebnis + &quot; &quot; + SchluesselWert;

STARTUPINFOW si;
PROCESS_INFORMATION pi; 

memset(&amp;si, 0, sizeof(si)); 
memset(&amp;pi, 0, sizeof(pi)); 
si.cb = sizeof(si); 

// Hier habe ich das Problem mit der Umwandlung.....
WCHAR szCommandLine[] = m_strStartProgramm; // Darf nicht const sein!!! 
if(!CreateProcessWithLogonW(L&quot;testaccount&quot;, L&quot;.&quot;, L&quot;hallo&quot;, LOGON_WITH_PROFILE, NULL, szCommandLine, NULL, NULL, NULL, &amp;si, &amp;pi))
// Der Punkt beim Parameter 2 bedeutet, das die lokale Benutzerdatenbank verwendet werden soll. 
{ 
LPVOID lpMsgBuf; 
FormatMessage( 
						FORMAT_MESSAGE_ALLOCATE_BUFFER | 
						FORMAT_MESSAGE_FROM_SYSTEM | 
						FORMAT_MESSAGE_IGNORE_INSERTS, 
	NULL, 
         GetLastError(), 
	MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 
	(LPTSTR) &amp;lpMsgBuf, 
	0, 
	NULL 
); 
MessageBox(NULL, (LPCTSTR)lpMsgBuf, NULL, MB_OK | MB_ICONEXCLAMATION); 
LocalFree(lpMsgBuf); 
// Bei Fehlermeldung: &quot;Der angegebene Dienst kann nicht gestartet werden...&quot; 
// überprüfe ob der Dienst &quot;Sekundäre Anmeldung&quot; aktiviert und gestartet ist! 
} 

	CloseHandle(pi.hProcess); 
	CloseHandle(pi.hThread);
</code></pre>
<p>Kann mir jemand Helfen ??</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/82959/ein-script-mit-parametern-ausführen-lassen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 08:14:34 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/82959.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 16 Aug 2004 13:51:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ein script mit Parametern ausführen lassen on Mon, 16 Aug 2004 13:51:30 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich möchte gerne ein Script mit zusatzparametern in meinem Projekt ausführen.<br />
Zusätzlich soll das Script mit einem besonderen Benutzrecht ausgeführt werden.</p>
<p>Mit der Umwandlung von WCHAR nach std string was den Kommand des aufrufes der .bat Datei beinhaltet, gibt es probleme.....</p>
<p>Wie wandle ich das um ??</p>
<p>Hier der Source</p>
<pre><code class="language-cpp">std::string m_strEinPfad2 = &quot;c:\test.bat&quot;;
std::string SchluesselPfad = &quot;TEST&quot;;
std::string SchluesselName = &quot;Schluessel&quot;;
std::string strErgebnis = &quot;1&quot;;
std::string SchluesselWert = &quot;2&quot;;

m_strStartProgramm =  m_strEinPfad2 + &quot; &quot; +  + &quot; &quot; +  SchluesselPfad + &quot; &quot; + SchluesselName + &quot; &quot; + m_strErgebnis + &quot; &quot; + SchluesselWert;

STARTUPINFOW si;
PROCESS_INFORMATION pi; 

memset(&amp;si, 0, sizeof(si)); 
memset(&amp;pi, 0, sizeof(pi)); 
si.cb = sizeof(si); 

// Hier habe ich das Problem mit der Umwandlung.....
WCHAR szCommandLine[] = m_strStartProgramm; // Darf nicht const sein!!! 
if(!CreateProcessWithLogonW(L&quot;testaccount&quot;, L&quot;.&quot;, L&quot;hallo&quot;, LOGON_WITH_PROFILE, NULL, szCommandLine, NULL, NULL, NULL, &amp;si, &amp;pi))
// Der Punkt beim Parameter 2 bedeutet, das die lokale Benutzerdatenbank verwendet werden soll. 
{ 
LPVOID lpMsgBuf; 
FormatMessage( 
						FORMAT_MESSAGE_ALLOCATE_BUFFER | 
						FORMAT_MESSAGE_FROM_SYSTEM | 
						FORMAT_MESSAGE_IGNORE_INSERTS, 
	NULL, 
         GetLastError(), 
	MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 
	(LPTSTR) &amp;lpMsgBuf, 
	0, 
	NULL 
); 
MessageBox(NULL, (LPCTSTR)lpMsgBuf, NULL, MB_OK | MB_ICONEXCLAMATION); 
LocalFree(lpMsgBuf); 
// Bei Fehlermeldung: &quot;Der angegebene Dienst kann nicht gestartet werden...&quot; 
// überprüfe ob der Dienst &quot;Sekundäre Anmeldung&quot; aktiviert und gestartet ist! 
} 

	CloseHandle(pi.hProcess); 
	CloseHandle(pi.hThread);
</code></pre>
<p>Kann mir jemand Helfen ??</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/583796</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/583796</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Mon, 16 Aug 2004 13:51:30 GMT</pubDate></item><item><title><![CDATA[Reply to ein script mit Parametern ausführen lassen on Mon, 16 Aug 2004 13:59:05 GMT]]></title><description><![CDATA[<p>Wenn du an der Konvertierung von string nach wchar_t* Probleme hast, dann schreib das doch. Dein geposteter Code hat mit ISO-C++ nicht viel am Hut und das Kernproblem wird in den FAQ sicher schon erklärt (meinetwegen auch string nach wstring; du solltest dich einfach allgemein mit weiten Zeichen und Strings befassen).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/583805</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/583805</guid><dc:creator><![CDATA[operator void]]></dc:creator><pubDate>Mon, 16 Aug 2004 13:59:05 GMT</pubDate></item><item><title><![CDATA[Reply to ein script mit Parametern ausführen lassen on Mon, 16 Aug 2004 14:39:16 GMT]]></title><description><![CDATA[<p>OK.<br />
sorry, dachte ich bring noch ein paar zusatzt infos mit ein.</p>
<p>Aber trotzdem,</p>
<p>wie wandle ich ein std::string in einen WCHAR um ??</p>
<p>Gruß und Danke<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/583836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/583836</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Mon, 16 Aug 2004 14:39:16 GMT</pubDate></item><item><title><![CDATA[Reply to ein script mit Parametern ausführen lassen on Mon, 16 Aug 2004 14:55:35 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>das muesstest du mal im WinAPI-Forum oder so fragen, denn Standard-C++ kennt<br />
kein WCHAR.</p>
<p>mfg<br />
v R</p>
]]></description><link>https://www.c-plusplus.net/forum/post/583845</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/583845</guid><dc:creator><![CDATA[virtuell Realisticer]]></dc:creator><pubDate>Mon, 16 Aug 2004 14:55:35 GMT</pubDate></item><item><title><![CDATA[Reply to ein script mit Parametern ausführen lassen on Mon, 16 Aug 2004 15:00:17 GMT]]></title><description><![CDATA[<p>Achso...</p>
<p>vielen Dank..</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/583847</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/583847</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Mon, 16 Aug 2004 15:00:17 GMT</pubDate></item><item><title><![CDATA[Reply to ein script mit Parametern ausführen lassen on Mon, 16 Aug 2004 15:12:38 GMT]]></title><description><![CDATA[<p>Es gibt mehrere Möglichkeiten:</p>
<pre><code class="language-cpp">size_t count = str.size() + 1;
wchar_t* p = new wchar_t[count]();

use_facet&lt;ctype&lt;wchar_t&gt; &gt;(locale()).widen(str.c_str(),str.c_str() + str.size(),p);
//oder
copy(str.begin(),str.end(),p);
//...
delete[] p;

//die simpelste
wstring wide(str.begin(),str.end());
</code></pre>
<p>Wobei in deinem Fall reicht ein einfaches copy.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/583852</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/583852</guid><dc:creator><![CDATA[Shlo]]></dc:creator><pubDate>Mon, 16 Aug 2004 15:12:38 GMT</pubDate></item><item><title><![CDATA[Reply to ein script mit Parametern ausführen lassen on Mon, 16 Aug 2004 21:31:38 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=3630" rel="nofollow">Gerard</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=4" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/584191</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/584191</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Mon, 16 Aug 2004 21:31:38 GMT</pubDate></item></channel></rss>