Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 05-01-2019, 03:23 PM
rmt rmt is offline
Senior Member
 
Join Date: Jun 2013
Posts: 299
Default Command Line not working from Delphi service

Dear Expert,

Need very urgent solution.

I am trying to run following commandline from delphi XE3 SERVICE but its not working. However, it is working as desired from other delphi5 application. Please suggest.

ExecuteResult := ShellExecute(0, 'open',pchar('aws.exe'), pchar(' s3 cp "c:\test2.csv" s3://myerofirstbucket/'), nil, SW_SHOWNORMAL);

Regards
__________________
Rmt

Last edited by rmt; 05-02-2019 at 03:05 AM.
Reply With Quote
  #2  
Old 05-02-2019, 07:20 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,333
Default

Delphi service has probably no interaction with the userinterface allowed.
Play with the SW_SHOWNORMAL, I guess it would be SW_HIDE (or whatever the equivilant is, no Delphi running at the moment)

Or perhaps it's as easy as that the service doesn't have permissions to write to c:\ or any other parts. I'm not familiar with aws, so don't know what rights are required.
But you can overcome rights by testing it with setting the service run as administrator user under services.msc

If that still doesn't work, try to log the "SysErrorMessage(GetLastError())" somewhere (windows event log idealy because of user permissions)
Reply With Quote
  #3  
Old 05-02-2019, 11:14 AM
rmt rmt is offline
Senior Member
 
Join Date: Jun 2013
Posts: 299
Default

Dear Norrit,

Thanks for reply.

I logged the message as below:

HTML Code:
ExecuteResult := ShellExecute(0, 'open',pchar('aws.exe'), pchar(' s3 ls s3://myerofirstbucket/'), nil,sw_normal );
str:=SysErrorMessage(GetLastError);
LogMessage(str, EVENTLOG_INFORMATION_TYPE, 0, 2);
Attached is the event viewer log. Please suggest how shall i proceed.

Thanks.
Attached Images
File Type: jpg Capture.jpg (19.2 KB, 9 views)
__________________
Rmt
Reply With Quote
  #4  
Old 05-03-2019, 09:30 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,333
Default

My eyes are probably not what they used to be, can you copy/paste the output instead of screenshot?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 03:00 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.