topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday December 10, 2024, 12:02 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Quick method to do simple task -must be a one click fix for those who need it :)  (Read 15063 times)

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
OK, I hope someone is in this morning.  This is easy but I can't figure out how to get it into a batch file for the people I am having to walk through manually.

I have a program that has a config file inside "/programdata/myprog/" so no one can even see it.
The file points the user to the correct IP address for the program to work.  I wrote a short script that I then made a shortcut to and gave the shortcut admin rights which swapped out the corrected cfg for the old one.

This worked for ME and for some people but not for others.  When I check their copy of "getthere.cfg" it is still the old one.

I need to edit the cfg file they have to change the only occurrence of IP "12.34.56.78" to IP "12.34.56.90".

How can I send them a script that will run "as admin" to open "c:\programdata\myprog\getthere.cfg" and change that ONE IP.  It is the only occurrence of the IP in the cfg file..

If I try to send them the new config file they can't insert it without admin permissions and I would never tell any of them how to get that ;)

And it has to be a one click fix.  That is all they can handle.

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
You could create a small Inno Setup installer with just a single [ini] entry to fix that. The default settings are to run as Administrator (after confirmation of the 'unknown publisher' as you probably don't have a code-signing certificate, and a UAC question), and just a few Next clicks further (after disabling almost all screens, 1 or 2) it should be fixed.
I can help you out with the script if you want.

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
might need you to as I do not know anything about "inno setup"  Never heard of it but if it does what I need this time, there are other times I have had (and will have) to do this again.
any way you can PM me or email or something so I don't have to clog up the board with something that probably wont help anyone but me?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
You could create a small Inno Setup installer with just a single [ini] entry to fix that. The default settings are to run as Administrator (after confirmation of the 'unknown publisher' as you probably don't have a code-signing certificate, and a UAC question), and just a few Next clicks further (after disabling almost all screens, 1 or 2) it should be fixed.
I can help you out with the script if you want.

Great idea.  Especially since Inno has a subset of Pascal for scripting.  Very straightforward to use.   :Thmbsup:

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
I already sent to you in your PM box

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
If you got it you may see an easier way to do this.
I swear I almost used AHK or some other mouse move capture this is SO easy and simple but if I were to show any of these people HOW to get into hidden files and get Admin permission to their own system it would be opening Pandora's Box for sure!

I can't even email them a corrected copy since THEY could not copy it to a folder they cannot see or have permission to write to.  Yet I KNOW there has to be a simpler way to do this.  I just can't seem to find it.  Probably TOO easy.

At this point though, the Best fix is going to be one I can zip up and email only to the ones who could not run it from the site where I keep utilities for them to use.

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
The trouble with doing this with AHK is you have to persuade your user(s) to run the exe As Administrator, and that's automatic for an (Inno Setup and other brands) installer, because of the manifest included in the exe :)

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
I've PM-ed you an Inno Setup script that, after some minor customization, can be compiled into a .exe file for sending to your customers/users.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
There's also Windows Powershell, good for anything Win7 or later, (since it's already installed):

Code: Text [Select]
  1. powershell -Command "(gc test.cfg) -replace '12.34.56.78', '12.34.56.90' | Out-File test.cfg"

@questorfla: I really think just a post in one forum or the other is sufficient to bring us out of the woodwork ;)
« Last Edit: December 06, 2014, 06:55 PM by 4wd »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
There's also Windows Powershell, good for anything Win7 or later, (since it's already installed):
To access files protected by UAC, it still requires the end-user to run PowerShell 'As Administrator', and that is what the OP is trying to avoid, IMHO...

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
There are patch generators that could do something similar, but I think using an inno setup installer to do it is a good idea -- it is likely to be left alone by most AV software.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member

@questorfla: I really think just a post in one forum or the other is sufficient to bring us out of the woodwork ;)

Is that a pledge to polish off his problem?  I'm sure he was just paranoid his query wood gather dust.  I mean he doesn't seem like the type to go against the grain;)

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
OMG!  LMAO!  Thanks so much you guys.  I think the issue is time differences.  I never consider that where some of you are it is still sleepy time.  I had a bunch of frantic people who needed that stupid cfg file edited to a new IP and not one of them is smart enough to just turn on hidden files and manually edit the stupid thing so I spent hours trying to find a way to beat MS at hiding stuff.

The ULTIMATE WINNER was the inno solution and I thank you very much Mr. ATH for that nifty compiler and if you had not taken the time to create that example script I would probably have never been able to figure it out soon enough.

These are people who cannot even extract a ZIP file ( I am dead serious!) so even with a working solution, I still had issues with a bunch of them as they kept trying to run it from inside the zip which was still in the attachment of their email.

The fact I told them NOT to do that and told them specifically how to extract it in the same email notwithstanding.
Anyway, I like the proggy and probably will get the paid version from the site as I can see it being useful again one day.

I have another quick post but it is a different subject so I will run it up the flagpole on another header.
Thanks again to all.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member

@questorfla: I really think just a post in one forum or the other is sufficient to bring us out of the woodwork ;)

Is that a pledge to polish off his problem?  I'm sure he was just paranoid his query wood gather dust.  I mean he doesn't seem like the type to go against the grain.  ;)

I'm thinking more of the possible answers all being in one place ... as questorfla has demonstrated by answering his other topic but not this one, and I've also been caught out by the same :)

To access files protected by UAC, it still requires the end-user to run PowerShell 'As Administrator', and that is what the OP is trying to avoid, IMHO...

DUH!  I forgot I don't have a password on the Admin account on this machine, so creating a shortcut with the command worked fine.  Oh well ...
« Last Edit: December 07, 2014, 06:37 PM by 4wd »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
I like the proggy and probably will get the paid version from the site
Their policy is very much DC-like: You can use the software for free and donate if, when and what you want, and can afford :Thmbsup:

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
I like the proggy and probably will get the paid version from the site
Their policy is very much DC-like: You can use the software for free and donate if, when and what you want, and can afford :Thmbsup:

It may be on the Inno third party listing someplace..  I remember there was a free program that let you embed themes in your installer.  Pretty easy to do.  It builds a small DLL into the install exe and you call functions in it to show your installer wizard themed.  In fact the setup program for my optical Tray program still has a themed install.


Capture.PNG



AzureToad

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 97
    • View Profile
    • Read more about this member.
    • Donate to Member

Is that a pledge to polish off his problem?  I'm sure he was just paranoid his query wood gather dust.  I mean he doesn't seem like the type to go against the grain.  ;)

I saw what you did there, stud.
Were you board [sic] when you wrote that?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member

Is that a pledge to polish off his problem?  I'm sure he was just paranoid his query wood gather dust.  I mean he doesn't seem like the type to go against the grain.  ;)

I saw what you did there, stud.
Were you board [sic] when you wrote that?

I admit I felt I had to gratuitously stick in that comment.  :)