Illuma Posted June 14 Share Posted June 14 Hi Any ideas on this? I just made a simple exe called WorkingDirTest with only this line in:- MsgBox(0, "Working Dir", @WorkingDir) I placed it in a folder called C:\Working Test, then I added the line below to the registry under hkey_local_machine\software\wow6432node\microsoft\windows\currentversion\run C:\Working Test\WorkingDirTest.exe When Windows starts the exe is run but the working directory shows as C:\Windows\SysWOW64 and not C:\Working Test If I run the exe file manually it shows the working directory as C:Working Test and if I create a batch file that launches the exe and make the registry run that at startup I get exactly the same result as launching the exe, and again if I manually run the batch file I get the correct C:\Working Test Any ideas on why? Cheers. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 14 Developers Share Posted June 14 This is how windows standard works! The WorkDir is the active directory at the time you start the program. You can easily change that in the script if so desired, just look at the helpfile FileChangeDir() to set the required Workdir in the script. When you like to change it to the ScriptDirectory, just use: FileChangeDir(@ScriptDir) Illuma 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Illuma Posted June 14 Author Share Posted June 14 Hi Jos Thank you for the fast answer, it's odd because on some PC's it works fine yet on others it wont. The only issue I have changing the working directory or even adding the path is they are not always the same on every PC I run my code on. Some systems have Windows on C drive then a partition like F drive where my files and folders are. Ideally I need the exe launch at startup but relate to the correct working directory wherever that may be. It's not a huge issue for me but I do like to try to know why things happen. Cheers. Link to comment Share on other sites More sharing options...
argumentum Posted June 14 Share Posted June 14 4 hours ago, Illuma said: It's not a huge issue for me but I do like to try to know why things happen. The script folder is where the script is at. The working folder is the one you run the script from. If you look at properties in a link ( any link in your desktop for example ), you're gonna see "Target" and an entry: C:\Users\UserName\SomeMoreFolders\blablabla.exe and below you're gonna see the "Start in" entry: C:\Users\UserName\SomeMoreFolders and that is the working folder. Hope this helps. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Solution Illuma Posted June 17 Author Solution Share Posted June 17 Thanks for the help guys. In the end I used @AutoItExe to get the path to the exe, then I stripped off the filename of the exe to get just the working directory and then I used FileChangeDir. That should work fine on any system. Cheers. 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