Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[c++] system("cmd line...")
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Thu Aug 21, 2008 12:19 am    Post subject: [c++] system("cmd line...") Reply with quote

does anyone know how to execute a system cmdline without poping up cmd window :/

i tried to use system(), it pops up a new window each time i use it. really annoying

_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils


Last edited by Bizarro on Thu Aug 21, 2008 12:20 am; edited 1 time in total
Back to top
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Thu Aug 21, 2008 12:20 am    Post subject: Reply with quote

What are you wanting to do on the command line?
_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Thu Aug 21, 2008 12:21 am    Post subject: Reply with quote

"sc create"
"sc start"

i use these cmd instead of CreateServices/StartServices because its much easier. all i need is 2 lines of cmd code instead of 2 pages winapi codes :/

_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Thu Aug 21, 2008 12:24 am    Post subject: Reply with quote

the command prompt executes programs from system32 folder, for example "shutdown -s" will start shutdown.exe with 1 parameter, 's'.

The commands you see when you type "help" are batch commands, which you can use any language to perform those. (if, else, copy files, moving files, creating folders, thats pretty much everything...)
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Thu Aug 21, 2008 12:31 am    Post subject: Reply with quote

its like

output = CMD.exe [input_command]

but C++ has built in function
system();
system("PAUSE");
would do command prompt command PAUSE.
http://www.cplusplus.com/reference/clibrary/cstdlib/system.html

IDK how to get stuff back doesn't seem like it gives stuff back

u might have to mess with GetStdHandle

_________________
Hacks I made for kongregate.
Kongregate Universal Badge Hack: http://forum.cheatengine.org/viewtopic.php?p=4129411
Kongreate Auto Rating/Voter hack: http://forum.cheatengine.org/viewtopic.php?t=263576
Took a test lol
Back to top
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Thu Aug 21, 2008 12:33 am    Post subject: Reply with quote

Pretty much anything you want to run off the command line will open up a window. As Symbol said, it just runs separate programs from the system32 folder. You're better off just using Win32 API to do most things. Because using system() just makes things slow and laggy. Its just not worth it.
_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Thu Aug 21, 2008 12:35 am    Post subject: Reply with quote

No u could mess with GetStdHandle.. and make a re-roution to your old console.. idk how.. but a friend once did it for me.. its when I was trying to make my own IDE for java compiling in C++.
_________________
Hacks I made for kongregate.
Kongregate Universal Badge Hack: http://forum.cheatengine.org/viewtopic.php?p=4129411
Kongreate Auto Rating/Voter hack: http://forum.cheatengine.org/viewtopic.php?t=263576
Took a test lol
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Thu Aug 21, 2008 1:33 am    Post subject: Reply with quote

you don't know what he's talking about. he's trying to start his driver.
_________________
Back to top
View user's profile Send private message
Wintermoot
Expert Cheater
Reputation: 0

Joined: 08 Nov 2007
Posts: 198

PostPosted: Thu Aug 21, 2008 4:35 am    Post subject: Reply with quote

The hacked up crappy way is to code your program to make a batch file that will do what you want then delete the batch file...
Back to top
View user's profile Send private message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Thu Aug 21, 2008 4:38 am    Post subject: Reply with quote

HawwwaH wrote:
The hacked up crappy way is to code your program to make a batch file that will do what you want then delete the batch file...

but does that still show a cmd window?

_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Thu Aug 21, 2008 5:03 am    Post subject: Reply with quote

Why don't you do it the proper way?

There is a header file from Microsoft that makes this very easy.

If you really want to do it that way, then I suppose you can try to get a handle for the window and hide it.
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Thu Aug 21, 2008 5:04 am    Post subject: Reply with quote

You really shouldn't do it this way! You should write a function (which could be used later with some other code.)

But anyway, something like this should work:
Code:
STARTUPINFO si;
PROCESS_INFORMATION pi;
::ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
::ZeroMemory( &pi, sizeof(pi) );

::CreateProcess( L"sc.exe",
   L"create",
   NULL,
   NULL,
   FALSE,
   0,
   NULL,
   NULL,
   &si,
   &pi
);
::WaitForSingleObject( pi.hProcess, INFINITE );

::CloseHandle( pi.hProcess );
::CloseHandle( pi.hThread );
Didn't show any windows for me. Tho, didn't do anything else, because there's no console allocated -> no help message. :D

Using ::system() is even more "dirty" than this. Again, you should write a function to perform your stuff.
Back to top
View user's profile Send private message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Thu Aug 21, 2008 5:14 am    Post subject: Reply with quote

yea i did write them all short awhile ago lol
createservices, openservices, startservices, controlservice and deleteservice.
so fcking long lol. also have to handle all the error...
can't believe its only 2 system() cmd lines =[

_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Thu Aug 21, 2008 5:24 am    Post subject: Reply with quote

Bizarro wrote:
also have to handle all the error...
That's just positive. Using ::system() or ::CreateProcess() you don't know if it failed or succeeded.

Bizarro wrote:
can't believe its only 2 system() cmd lines =[
Code:
#include "myservices.h"

MyHandle h = myservices::createservices("test");
myservices::startservices(h);

..or something..
Oh noes, 3 lines + a blank one! But, performance is at least 10x higher on the very first run and following ones the difference isn't that huge, but it still is.
Back to top
View user's profile Send private message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Thu Aug 21, 2008 5:53 am    Post subject: Reply with quote

dam did u find the wrapper online or made it urself :O
_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites