Click here to Skip to main content
15,888,100 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have made a code in c++ i am using _popen() to execute wmic commands but this is causing cmd to pop up for a split second that i don't want i want to run it in background without popping anything like cmd not even for a split second
this is what i am doing to hide console but it doesn't stop cmd for appearing for a split second and i checked with process explorer that when i use wmic it opens cmd otherwise it runs fine for e.g i am able to write into a text file without any cmd console popping
i am posting my code below

What I have tried:

while (fgets(line2, 256, CommandResult2))
{
line8 = line2;
if ((offset = line8.find(search0, 0)) != string::npos)
{
line8.erase(0, 39);

// cout << line8 << endl;
line8.erase(line8.size() - 1);
Ipv4 = line8;
_pclose(CommandResult2);
// IPFile.close();
}
}
Posted
Updated 19-Feb-20 18:27pm
v2

1 solution

See the Remarks section at _popen, _wpopen | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900