New
#1
Trying to understand behavior of current directory and PATH variable.
The PATH variable on my machine is set to
C:\Perl64\site\bin;C:\Perl64\bin;C:\Windows\System32;C:\Program Files\Java\jdk1.7\bin;C:\Program Files (x86)\Notepad++;
I have a batch file (batchfile.bat) with the following commands -
dir
path
notepad++ source.frm -n2150
PAUSE
When I double click the batch file, I get the following output.
So far so good. Now, in the Excelfile.xlsx which is part of the current directory, I have a hyperlink that links to the batch file. However, when I click on this hyperlink, the current directory somehow changes to the Documents directory. Also, an additional entry is made temporarily to the PATH variable-Code:C:\ExcelExperiments>dir Volume in drive C has no label. Volume Serial Number is FC18-1C2F Directory of C:\ExcelExperiments 04/02/2012 12:42 PM <DIR> . 04/02/2012 12:42 PM <DIR> .. 04/02/2012 12:43 PM 45 batchfile.bat 04/02/2012 12:32 PM 32 Commands.txt 04/02/2012 12:28 PM 16,793 Excelfile.xlsx 03/09/2012 12:44 PM 308,196 source.frm 4 File(s) 325,066 bytes 2 Dir(s) 858,609,614,848 bytes free C:\ExcelExperiments>path PATH=C:\Perl64\site\bin;C:\Perl64\bin;C:\Windows\System32;C:\Program Files\Java\jdk1.7\bin;C:\Program Files (x86)\Notepad++; C:\ExcelExperiments>notepad++ source.frm -n2150 C:\ExcelExperiments>PAUSE Press any key to continue . . .
How to prevent this changing of the current directory? Also, why is the additional entry made to the PATH variable?Code:C:\Users\owner\Documents>dir Volume in drive C has no label. Volume Serial Number is FC18-1C2F Directory of C:\Users\owner\Documents 03/20/2012 04:54 PM <DIR> . 03/20/2012 04:54 PM <DIR> .. 02/08/2012 10:11 AM <DIR> Aptana Studio 3 Workspace 02/16/2012 03:37 PM <DIR> My Kindle Content 03/19/2012 11:05 AM <DIR> My Meetings 02/22/2012 01:43 PM <DIR> NetBeansProjects 02/16/2012 04:04 PM <DIR> SQL Server Management Studio 02/16/2012 04:02 PM <DIR> Visual Studio 2005 03/12/2012 12:06 PM <DIR> Visual Studio 2008 03/12/2012 12:23 PM <DIR> Visual Studio 2010 0 File(s) 0 bytes 10 Dir(s) 858,609,233,920 bytes free C:\Users\owner\Documents>path PATH=C:\Program Files (x86)\Microsoft Office\Office14\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Windows\System32;C:\Program Files\Java\jdk1.7\bin;C:\Program Files (x86)\Notepad++; C:\Users\owner\Documents>notepad++ source.frm -n2150 C:\Users\owner\Documents>PAUSE