Quantcast

Maximum PC

It is currently Mon Dec 22, 2014 10:33 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Quick Question
PostPosted: Fri Feb 05, 2010 7:38 pm 
Northwood
Northwood
User avatar

Joined: Sun Jul 15, 2007 6:37 pm
Posts: 2261
Location: No. 1 Thread Killer
in C++ how does one write an app that can force commands through the console window?

Like I find myself using certain commands repetitively in dos, and would be nice if I could have an app where you can browse to a file, set that file, then select the command to execute on the file and bam i'm done instead of having to retype the same things every time.


Top
  Profile  
 
 Post subject:
PostPosted: Wed Feb 17, 2010 7:21 pm 
Team Member Top 100
Team Member Top 100

Joined: Sun Feb 12, 2006 2:52 pm
Posts: 1994
Location: Cryptogram City!
Can you give an actual example of what you want?

I'm thinking of system("dir *.*"); type of code, built into a menu system, but using system(), is not a very elegant way to do this.

Give a couple exmples, and I'm sure I can give you something better than just using system().


Top
  Profile  
 
 Post subject:
PostPosted: Thu Feb 18, 2010 4:48 am 
SON OF A GUN
SON OF A GUN
User avatar

Joined: Mon Nov 01, 2004 5:41 am
Posts: 11605
This is what batch scripts and powershell is for.....


Top
  Profile  
 
 Post subject:
PostPosted: Thu Feb 18, 2010 9:58 am 
Northwood
Northwood
User avatar

Joined: Sun Jul 15, 2007 6:37 pm
Posts: 2261
Location: No. 1 Thread Killer
Like I have to run a program called tool (it's 100% command line based)

Example of what I type:

cd <directory of Tool>
tool bitmaps <dir>
tool bitmap <dir> filename
tool build-cache-file <dir>


Top
  Profile  
 
 Post subject:
PostPosted: Fri Feb 19, 2010 10:24 am 
SON OF A GUN
SON OF A GUN
User avatar

Joined: Mon Nov 01, 2004 5:41 am
Posts: 11605
put that in a batch file, you win.

http://www.google.com/search?q=windows+ ... parameters


Top
  Profile  
 
 Post subject:
PostPosted: Fri Feb 19, 2010 12:01 pm 
Northwood
Northwood
User avatar

Joined: Sun Jul 15, 2007 6:37 pm
Posts: 2261
Location: No. 1 Thread Killer
Ooooh I didn't know I could pass parameters to a batch file.

So, for example/pseudocode

#include <stdlib.h>
#include <necessary stuff>

<get user's desired command>
<get user's desired file path>

system("execTool.bat" + desired_command + desired file_path );


Top
  Profile  
 
 Post subject:
PostPosted: Sat Feb 20, 2010 5:12 pm 
SON OF A GUN
SON OF A GUN
User avatar

Joined: Mon Nov 01, 2004 5:41 am
Posts: 11605
Why do you need to use C++ at all? You can have a batch script / powershell script to do everything you need.


Top
  Profile  
 
 Post subject:
PostPosted: Sun Feb 21, 2010 5:09 pm 
Northwood
Northwood
User avatar

Joined: Sun Jul 15, 2007 6:37 pm
Posts: 2261
Location: No. 1 Thread Killer
For a gui.


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© 2014 Future US, Inc. All rights reserved.