Reputation: 1
I'm a beginner to C++ programmer and to Stackoverflow
I'm trying to use system()
to call an .exe from my program to convert RTF to plain text by using:
system("converter.exe convert doc.doc > doc.txt")
from my understanding of system()
==>> system("program.exe arg1")
.
When I compile this code it brings up the converter.exe but it does not give me the output (.txt).
I came to the conclusion that Visual Studio 2010 uses non-administrative CMD to open this .exe where the program just pop up for 1 sec and disappears (also I need to press "ok" before executing).
Any suggestions how to run system()
with administrator permission ?
PS: I tried changing the "run as administrator" on the .exe but it appears that the system doesn't allow me to change anything.
Upvotes: 0
Views: 1695
Reputation: 74088
If you really need admin privileges, consider using runas:
system("runas /user:foo \"converter.exe convert doc.doc > doc.txt\"")
Upvotes: 2