0

I have similar problem to the one discussed at InstallScript can not read text file containing result from command prompt In this case I am trying to query the state of a windows service and direct the output to a text file. I have previously created the file via the CreateFile function

svNewDir = "C:\\Program Files (x86)\\Tools\\IPCon";
svNewFile1 = "IPConService_State.log";

ChangeDirectory (svNewDir);

if (CreateFile (nvFileHandle, svNewDir, svNewFile1) < 0) then
    My_AddToLog("Check_IPCon_Status - Fail");
    bIPCon_Status = FALSE;
    return bIPCon_Status; 
endif;

OpenFileMode (FILE_MODE_APPEND);

__LaunchAppAndWait("sc.exe","queryex IPConService > IPConService_State.log\");

At installation time I can see that the IPConService_State.log is created in the directory as expected, also I see that the sc query command is correctly launched, but the output from the sc query command is not directed to the file which remains empty.

Later when I open a CMD prompt (Admin Mode) change to the same directory and enter the exact same
command, it works.

I know that my login account on the test PC has full Admin Rights, as I am able to create the log files, and therefore the commands launched from my installer under that account also have full admin rights, so there is no reason why the sc query command launched from my script should not be successful, while the same command launched from CMD was successful.

Thanking readers in advance for any advice given which would be most appreciated.

Sproggit
  • 61
  • 7

0 Answers0