Hi,
I'm trying to use the system() command to invoke "eseutil.exe" and store the output in a text file using VC++. The way i used this command is mentioned below.

code snippet:
=========

``````string command= "\"C:\\Program Files\\Microsoft\\Exchange Server\\Bin\\eseutil.exe\" /mh \"F:\\fsg\\edb\\mailbox database.edb\" | find \"Log Required\" >output.txt";

system(command.c_str());``````

Compilation is success. But while executing the program i'm getting the following error.

'C:\program' is not recognized as an internal or external command,
operable program or batch file.

Few questions:
===========
1. Is it possible to use system command as above (with full path)?
2. Is it mandatory to specify the path or simply like system("eseutil.exe /mh \"F:\\fsg\\edb\\mailbox database.edb\" | find \"Log Required\" >output.txt"); is enough?
3. If path is not specified to eseutil, will system command automatically detects the path ?

Can anyone explain or give any link that explains the behavior of system() command ?

Thanks
Inmar

Edited by inmar: n/a

5
Contributors
8
Replies
12
Views
8 Years
Discussion Span
Last Post by donaldw

1. Have you tried

``string command= "C:\\Program Files\\Microsoft\\Exchange Server\\Bin\\eseutil.exe\" /mh \"F:\\fsg\\edb\\mailbox database.edb\" | find \"Log Required\" >output.txt";``

Deleting the first "\ before "C:\\ etc..?

2. I don't think it's necessary to specify the full path. If your app.exe is in the same folder as your program, you can simply specify system(app.exe);

3. Links to 2...the path is not 'automatically' detected but again, if the .exe is in the same folder then I believe you do not need to specify the full path.

Hi,
I have tried by deleting \" before C: But the same error
Am I doing any mistake in the above syntax ? Please suggest me.

Thanks
Inmar

Have you tried invoking the command directly into cmd just to make sure it works?

Yes....I have tried the following

``system("eseutil.exe /mh \"F:\\fsg\\edb\\mailbox database.edb\" | find \"Log Required\" >output.txt")``

Also manually ran the command from the command prompt

Both works fine.

But I want to achieve the task by specifying the path to eseutil.exe

Help !!!!!

Edited by inmar: n/a

Try popping in a %20 for the space
"C:\\Program%20Files\\Microsoft\\Exchange%20Server\\Bin\\eseutil.exe\"
Having the path in quotation marks should take care of that but it seems like in your other example it's truncating based on the space.

When I use,

C:\program%20files\microsoft\exchange%20server\bin\eseutil.exe /mh "F:\fsg\edb\mailbox database.edb" | find "Log Required" >output.txt

The error is
"The system cannot find the path specified."

Edited by inmar: n/a

system() is prohibited on Windows.
Use SE() or any other api

No, it's not. Windows is not redefining the C++ standard

system() is prohibited on Windows.
Use SE() or any other api

Patently false.

I use

``````command.Format("wget %s -O C:\\Path\\log\\%s.mp3", testAudio, timeStamp);	// format command do download audio (check if present)
system(command);``````

in some of my code and it works just fine under all versions of Windows on which I've tried it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.
{"extraction_info": {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.885165810585022, "perplexity": 5129.787806987398}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-13/segments/1521257647244.44/warc/CC-MAIN-20180319234034-20180320014034-00726.warc.gz"}