Jump to content

update/prepend the path variable


Recommended Posts

Hi

How do I update/prepend the path variable using AutoIt?

I have a program.exe file which I want to put at the beginning of the path (I want this program to be seen before any other programs).

Thanks,

Raj

Link to comment
Share on other sites

Unless you plan to lock down a PC for some reason, that is usually a maulware trick. Care to share why you need to have this load before anything else?

I really think this is to run a file/argument... no?

8)

EDIT

Example...

@AutoItExe & $My_AU3_File

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Unless you plan to lock down a PC for some reason, that is usually a maulware trick. Care to share why you need to have this load before anything else?

Hi Volly,

The reason is that I have a program whose behavior depends upon the number of arguments that are passed to it. I wrote a wrapper around it (I named the wrapper with the same name as the program). So, I want the wrapper to be called before the default program is called.

Also, if I have an exe file, is there anyway in which I can include the exe file and compile the autoit script, so that the resulting autoit exe doesnt need the original exe to run(in other words I want the compiled version of the script to be independent of the exe file that I include in the AutoIt script using Run()).

Thanks,

Raj

Link to comment
Share on other sites

I really think this is to run a file/argument... no?

8)

EDIT

Example...

@AutoItExe & $My_AU3_File

I'm thinking along the lines of Volly here. The way I read it he wants to set the Path environment.

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 comment
Share on other sites

I really think this is to run a file/argument... no?

8)

EDIT

Example...

@AutoItExe & $My_AU3_File

Hi

I want to modify the PATH environment variable. I want this program to run before any other program with a similar name.

Thanks,

Raj

Link to comment
Share on other sites

you can include the exe in your script by using fileinstall. However, when your script runs, it will be confused by the fact you are trying to use the same exe name at the same time. I would rename the original exe with a _ at the start of it's name before compiling it.

Edited by Volly
Link to comment
Share on other sites

you can include the exe in your script by using fileinstall. However, when your script runs, it will be confused by the fact you are trying to use the same exe name at the same time. I would rename the original exe with a _ at the start of it's name before compiling it.

Thanks for your reply Volly. May be some code will help clarify my point(or help me understand your point):

CODE
;;Form a command line argument string with the rest of the arguments

$argumentString = ""

For $i = 2 to $CmdLine[0] Step 1

$argumentString = $argumentString & $CmdLine[$i]

$argumentString = $argumentString & " "

Next

;

$commandString = "C:\rpctool.exe" & ' "' & $argumentString & '"'

Run(@ComSpec & " /c " & $commandString, "", @SW_HIDE)

Above is my wrapper script. The exe file I was referring to is C:\rpctool.exe

The reason I want to put this(the compiled version of this wrapper) in my path before anything else is that my users expect it to work with an optional first argument which is not needed by rpctool.exe program. So, I am just ignoring the first argument when creating the $argumentString.

Please let me know if you have any questions.

Thanks,

Raj

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...