topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Saturday December 14, 2024, 9:21 pm
  • 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: need a quick fix for something easy. Script to change a single word in text file  (Read 3385 times)

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Posted in another place but might get answer here too.  Need to figure out asap.

I have a program that has a config file inside "/programdata/myprog/" so no one can "see" it unless they have access to hidden files.  It needs to be edited anyway and that cant be done unless they have admin rights.
The file points the user to the correct IP address for the program to work.  I already tried making batch/shortcut with admin and evn tried run as admin (for those who called and asked)

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 their "getthere.cfg" file to change the only occurrence of an IP (example)"12.34.56.78" to IP "12.34.56.90".  These people are located all over the place and so far I have had to connect to each of them with Teamviewer or other and do it for them.

How can I send them a script that will run "as admin" on their system to open "c:\programdata\myprog\getthere.cfg" and change that ONE IP address.

Even if I send them the new config file they can't insert it without having admin privileges and I would never tell any of them how to get that :down: ;)

And it has to be a one click fix.  Trust me, that is all they can handle.
  

 
  
 
« Last Edit: December 06, 2014, 02:58 PM by questorfla, Reason: spelling »

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
OMG!  I solved the problem and I knew there would be a "DUH" factor in it but this one is so big I almost cannot believe it!  Problem solved and I even found others researching how to do this on other forums so I don't feel so bad.  As I expected, I was trying way to hard. 

Solution:  Take the corrected file, Zip it with regular windows 8 compress.  Attach it to an email to send who needs it, they save attachment to desktop (or anywhere). Right click and choose extract and the next step was the solution.

Just change the destination to be c:\programdata\foldername\.  The fact that it neither needed nor asked for any permissions to do this is what I could not believe as this is a hidden folder that needs admin permission to even edit files already there.  Yet it allows you to overwrite the old one with the new one and only has the normal "YES, Overwrite" option no matter who you are apparently.
Anyway, thanks to all those who read and any who offered options  I am sure that the other solutions will come in handy one day but for now, I know how to write files to a hidden protected folder no matter who I am.  Just extract them there.  :)  I even tried putting a copy in c:\windows\system32 just to see what it would do and the worst I got no matter where I chose was a window asking permission to proceed.  it went there every time.   In case anyone ever needs to get files to somewhere they normally can't.


Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
I'm not so sure this actually is going to work on all computers. I must assume that most have UAC in the default setting, so it won't allow 'just any application' to write in system-reserved directories.
Is UAC turned off, or are you testing on Windows XP (but that's unlikely when you mention "C:\ProgramData") ?