Jump to content

Comspec do not open chm file when my script run as service


Recommended Posts

The Run() function can only run executable files, aka .exe, .bat, .pif, .com, etc.

A chm is not a executable file, so it doesn't know how to execute it. Instead, use the beta version of autoit and use the ShellExecute function:

ShellExecute ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] )

ShellExecute("AutoIt3.chm")
oÝ÷ Øò¢çhmÁ©í¶h¶­²)©'hjË!£  âØ^~e£§ìZ^jëh×6
Run(@WindowsDir & '\hh.exe "D:\Program Files (x86)\AutoIt3\AutoIt3.chm"')
Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to post
Share on other sites

Yes this is work when i run my script as user but do not work when i run my script as service!!!

@comspec open a window so a session must be open.

I am not too familiar what can really be done with services even with ShellExecute ;)

Link to post
Share on other sites

Yes this is work when i run my script as user but do not work when i run my script as service!!!

A service by default does not interact with a user desktop. There is an option that be enabled to allow interaction with the desktop in services.msc.

;)

Link to post
Share on other sites

By default, service is running under SYSTEM account. Many things are act different under SYSTEM. Try to create a service running under user id other than local SYSTEM and test.

Edited by Joon
Link to post
Share on other sites

By default, service is running under SYSTEM account. Many things are act different under SYSTEM. Try to create a service running under user id other than local SYSTEM and test.

But i want it run under SYSTEM account. It is ok if i run an exe but not for chm file!!!!

Link to post
Share on other sites

But i want it run under SYSTEM account. It is ok if i run an exe but not for chm file!!!!

If an EXE file runs then I think ShellExecute() should work.

Example

CODE
ShellExecute(<folder path> & "\My_File.chm"
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to post
Share on other sites

If ShellExecute() doesn't work, feel free to use this program i just wrote and run the parameters to it. It should not have the same restrictions as a service since it isn't being run as a service.

This is a ShellExecute.exe I wrote in Freebasic that is 5KB and has a small documentation txt file and an example batch file:

ShellExecute.zip

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to post
Share on other sites

But i want it run under SYSTEM account. It is ok if i run an exe but not for chm file!!!!

I just tested, you can not run CHM file with SYSTEM account. Running hh.exe test.chm won't open. There are things you can not do with SYSTEM account like.

Can't use UNC path or RunAs, etc...

Link to post
Share on other sites
  • 5 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...