rudi Posted May 31, 2008 Share Posted May 31, 2008 (edited) Hi. When you run a command from a CMD box, then the current path, afterwards all paths in %path% and CMD.EXE / COMMAND.COM are searched to serve the given command. If all fail, a "Command or file not found" is the final result. I'd like to insert an autoit3 script in that "search chain", so that I could pack there a lot of custom commands. No clue if such a thing is possible Any suggestions appreciated, regards, Rudi. Edited May 31, 2008 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
ResNullius Posted May 31, 2008 Share Posted May 31, 2008 Hi.When you run a command from a CMD box, then the current path, afterwards all paths in %path% and CMD.EXE / COMMAND.COM are searched to serve the given command.If all fail, a "Command or file not found" is the final result.I'd like to insert an autoit3 script in that "search chain", so that I could pack there a lot of custom commands.No clue if such a thing is possible Any suggestions appreciated, regards, Rudi.For a permanent change to the path, there are two registry keys (on XP anyway) that hold the values.One for the global "system" path, applies to all users: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environmentlook for the "Path" valueThe other is user specific:HKEY_CURRENT_USER\Environmentagain, look for the "Path" entryEach of these is a semicolon delimited list of the paths to search in order of the search. To make your AutoIt Script folder the first searched path, insert it at the begining of the list followed by a semicolon. To make it the last searched, append it to the end making sure there is a semicolon between it and the previous entry. Link to comment Share on other sites More sharing options...
rudi Posted June 1, 2008 Author Share Posted June 1, 2008 For a permanent change to the path, there are two registry keys (on XP anyway) that hold the values. One for the global "system" path, applies to all users: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment look for the "Path" value The other is user specific: HKEY_CURRENT_USER\Environment again, look for the "Path" entry Each of these is a semicolon delimited list of the paths to search in order of the search. To make your AutoIt Script folder the first searched path, insert it at the begining of the list followed by a semicolon. To make it the last searched, append it to the end making sure there is a semicolon between it and the previous entry. Yes, I know where to modify the %PATH% variables for system and user, but that wasn't my question. I'll try to prase my question more precisely: If I type in a CMD box "foobar" [enter] iirc the system is doing this: 1.) look, if the "foobar" is a CMD.EXE internal. If not, then 2.) look in the current path, if there is a foobar.bat, foobar.com, foobar.exe ..., if this fails, then 3.) look in every folder specified in the %PATH% variable to do the same, if this fails, then 4.) return the message "Command or file not found" I'd like to insert some kind of 2nd level CMD.EXE (MYCMD.EXE) inbetween 1.) and 2.). MYCMD.EXE shall be fishing for "foobar", and then executing some other program (that I do NOT want to drop in a folder in the %PATH% specified folders. Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
martin Posted June 1, 2008 Share Posted June 1, 2008 (edited) Yes, I know where to modify the %PATH% variables for system and user, but that wasn't my question. I'll try to prase my question more precisely: If I type in a CMD box "foobar" [enter] iirc the system is doing this: 1.) look, if the "foobar" is a CMD.EXE internal. If not, then 2.) look in the current path, if there is a foobar.bat, foobar.com, foobar.exe ..., if this fails, then 3.) look in every folder specified in the %PATH% variable to do the same, if this fails, then 4.) return the message "Command or file not found" I'd like to insert some kind of 2nd level CMD.EXE (MYCMD.EXE) inbetween 1.) and 2.). MYCMD.EXE shall be fishing for "foobar", and then executing some other program (that I do NOT want to drop in a folder in the %PATH% specified folders. Regards, Rudi.If you want custom commands then the 3 easiest ways that I can think of One You have your own program which is passed the command as a parameter like this C:\> SpecialProg foobar Two You have a batch file, exe or script in one of the search paths which is named foobar.bat or foobar.exe or foobar.wsh or foobar.au3. Three If you have a compiled AutoIt script, say MyCmd.exe, and you associate *.zzz with that, then you can run the MyCmd.exe with foobar.zzz as a parameter by typing foobar.zzz. Edited June 1, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
rudi Posted June 2, 2008 Author Share Posted June 2, 2008 If you want custom commands then the 3 easiest ways that I can think ofOneYou have your own program which is passed the command as a parameter like thisC:\> SpecialProg foobarThen I always have to enter two things, the prog's name + parameterTwo You have a batch file, exe or script in one of the search paths which is named foobar.bat or foobar.exe or foobar.wsh or foobar.au3.That's, what I currently do: some 150+ CMD files in \\server\sys\public\ folder ThreeIf you have a compiled AutoIt script, say MyCmd.exe, and you associate *.zzz with that, then you can run the MyCmd.exe with foobar.zzz as a parameter by typing foobar.zzz.Hm. That might be an alternative way. Basically I wanted to get rid of the Two solution by introducing an additional "Command Line Filter" between CMD.EXE and the %PATH% search...Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now