I'm using a .bat file for installation purposes and I'm using ".\" very often when I need to access files (for example for an unzip) in order so get which directory I'm in.
It worked quite well until yesterday when suddenly I had 2 different behaviours:
- Lauched from command console (with the console inside the directory): The file works as normal and knows where .\ is at.
- Launched from windows explorer it also functions if it is not started with administrator rights
- If launcehd from windows explorer with administrator rights the executing directory (thus the directory which is printed with cd if its the first command in the .bat file) suddenly is c:\windows\system32
This behaviour like I said started just a few days ago (2 days ago we saw it for the first time when we tried that .bat file), before that it worked from windows explorer exactly the same as from the command console.
So my question here is twofold:
- Is there anything known as to the cuase of this changed behaviour?
- How can I get a handle to the current directory that the .bat file is located in (because the .zip file will always be in the same directory as the .bat file itself), thus how can I solve this problem as I need to start the file with administrator privileges
I found that there is a similar issue in windows vista: Windows batch file starting directory when 'run as admin' although what intrigues me there is why the problem did not appear for weeks and only appeared recently with windows 8