2
I had a simple batch file I would use in Windows XP to create a set of specific subfolders inside a folder. I had it set up as a Right-Click context menu so that when I right-clicked on a folder within Windows Explorer, I could execute the batch file and have the 10 specific folders created inside it.
I moved the same batch file to Windows 7. I can run the batch file manually and it works fine, however when I run it from the Right-click context menu, the folders are all created in the \Windows\System32\ directory, not in the colder that I had right-clicked upon.
I know that the "Current Directory" in Windows XP used to carry the value of the right-clicked folder, now in Windows 7 the Current Directory value seems to change to the System32 folder.
I was trying to find a way to read the current directory that the mouse right-clicked on, but cannot find that value. "CD" is the System32 folder at the start of the batch execution.
Any suggestions?
How are you adding it to the right-click menu? – nhinkle – 2011-04-04T17:31:04.910
Are you using relative paths or absolute paths in the script? Windows 7 changed a lot of the paths, so it may be defaulting to where the batch file executer is if it can't find the path. – beatgammit – 2011-04-04T17:35:07.857
It would help if you posted the script itself. I have a feeling that it has to do with the paths specified in the file and where the batch file is located. It also probably has a lot to do with the exact registry entries that were used to make it available in the right click context menu. In batch, %CD% will be the path that the batch file is run from. – MaQleod – 2011-04-04T18:54:55.057