Page 1 of 1

Running a commandline utility

Posted: Mon Oct 08, 2012 3:49 am
by lbertoldi
I am trying to run a commandline utility for a very specific task.
I added the .exe as a support file and tried to run it with "run program as" by using this path "$SUPPORTDIR$\WmiSecurity.exe" and passing the correct parameters in. Nothing happens.
Guess there's something wrong but I do not know what it could be, so I started to investigate the issue.

1) I tried to log the installation, I only got a 1.6 mb file FULL of useless internal info, there's not even a mention of the program being executed! There's no mention of the support file being copied to the support folder, too.

2) I added some logging by using "write to text file" with $LOGGED$. The log file became an unreadable mess. No luck here, I found a topic that tells me I should use a different file to log my own info. Done it, the parameters look correct in my log.

3) So, thinking that I could see the error in action, I changed the package to run a batch file (adding a "pause" command), created using "write to text file" actions. The file isn't created at all. Maybe the help is wrong and the action only appends to an existing file? No, I also tried to distribute an empty batch file, but no luck again. Maybe it's a short path issue? Nope, I also tried with the "convert path" action.

I am probably doing something horribly wrong, I really hope so, but the main problem here is that the debug is a real pain, I have no clue from the IDE and neither from the log file.

Before you ask, I am attaching a sample project. And also, before you tell me so, I DO NOT want to upgrade to NX to solve this.

I will probably seem rude here, but I am literally filling my setup with hacks and I am a bit tired of this.
Regards

Re: Running a commandline utility

Posted: Mon Oct 08, 2012 8:41 am
by FrancescoT
Dear User,

no one of us will force you to upgrade to InstallaWare NX, but ... I don't understand what you mean with:
I will probably seem rude here, but I am literally filling my setup with hacks and I am a bit tired of this.
Let me verify your project and I will be back as soon as possible.

Regards.

Re: Running a commandline utility

Posted: Mon Oct 08, 2012 9:44 am
by lbertoldi
Hi FrancescoT, thanks for your quick reply.
My reference to NX is related to a previous answer (yours, if I remember correctly) on a different problem. Basically, I was told to test the problem on NX, while I only have licenses for the 2012.
The hacks I am referring to are several workarounds and forum suggestions I had to implement in my setup to make several things work.

Regards

Re: Running a commandline utility

Posted: Mon Oct 08, 2012 9:54 am
by FrancescoT
Dear User,

Probably I was misinterpreted ... actually I don't remember the specific question... but I suppose I only suggested to verify with IA NX.

By the way, let me verify your project ... and I will tell you.

Regards

Re: Running a commandline utility

Posted: Tue Oct 09, 2012 2:23 am
by alibaba
I ran your project and the batch-file was not generated...

Re: Running a commandline utility

Posted: Tue Oct 09, 2012 7:49 am
by lbertoldi
That's the point.
The code looks correct (well, to my eyes at least :)) but the result does not.
I hope they are able to discover the problem in my code, as I am not...

Re: Running a commandline utility

Posted: Tue Oct 09, 2012 9:11 am
by FrancescoT
Dear lbertoldi,

Please use the attached project and verify if solves your issue.
I have tested it and seems to work fine now.

By the way, don't use quotes with Write To File and Run Program commands ... because IA already handles the parameter in the correct way.

Hope this helps you.

Regards

Re: Running a commandline utility

Posted: Wed Oct 10, 2012 5:41 am
by lbertoldi
Thanks, Francesco, it worked!!!
I could have sworn I tried without the quotes, but apparently I didn't. My bad.

My point still stands, though: why does the logged installation not log anything useful in the log file? Each command has a set of parameters, so it should be easy for you to log the command itself, the parameters and the result along with any error. I am not even able to understand if a specific command has been run or not.
So, if IA logged something like "file not found ""c:\...\cfgwmi.bat""" I could have guessed that the quotes were not needed...

However, thanks again for your support!

Re: Running a commandline utility

Posted: Wed Oct 10, 2012 11:04 am
by FrancescoT
Happy that you solved.

The log reports mainly the log queue generated by the MSI engine and the "Write to Text File" is a direct execute command, executed outside the MSI engine.

Regards

Re: Running a commandline utility

Posted: Thu Oct 11, 2012 1:31 am
by alibaba
lbertoldi,

I use the Plugin Camelot, that includes a function "WriteToLogFile". With it your can log you own script. This should help you!

Re: Running a commandline utility

Posted: Thu Oct 11, 2012 3:24 am
by lbertoldi
Thanks alibaba, I will give that a try!