My Procedure last day as below
Click Start, Run and type Regedit.exe Navigate to the following branch:
HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor
In the right-pane, double-click Autorun and set the startup folder path as its data, preceded by “CD /d “. If Autorun
value is missing, you need to create one, of type REG_EXPAND_SZ or REG_SZ in the above location.
Example: To set the startup directory to D:\learning\perl, set the Autorun value data to CD /d D:\learning\perl
Then I clicked Start, run and type cmd. It successfully. I could do perl practice more conveniently now.
But today,开发者_如何转开发 I find when I try to build my Visual Studio 2005 solution which included some Pre-build event Command like this:
perl.exe MyAppVersion.pl
perl.exe AttrScan.pl
It doesn't work. Show error: can't find the path.
I check the environment variable setting and find the variable-path
and it's value-c:\perl\bin\;
still exist.
Finially, I try to removed the Regedit.exe configuration "Autorun" value and test again. The issue fixed.
I only changed the default startup directory for cmd.exe command. Why the pre-build event perl command was impacted? (I am using winxp and activePerl 5.8)
It looks like Visual Studio is using cmd.exe to execute perl.exe. This is not unusual, and changing the registry as you have done can also impact other programs, not just Visual Studio.
Just do the CD /D manually or create a link to cmd.exe that sets d:\learning\perl as the starting directory.
I have noticed on windows 7 x64 that jdigitals suggestion to create a link that sets d:\learning\perl as the starting directory does not work. Cmd.exe will not take that as a legal parameter. Also, in Windows 7 the key refered to by brian d foy does not exist. So on windows 7 it just doesn't seem possible to get a cmd to start in the right directory if it is not on the system volume (C:). So as far as i'm concerned this isn't solved.
Seems like this has nothing to do with Perl, but is a Windows problem:
I had the HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor \ AutoRun
set to C:\Work.
When trying to use git from within vim, neither vim nor gvim worked with the vim-plugin.
The working directory when an application was called was always forced to C:\Work.
Even though I had the right file from a versioned repository opened in the editor, and it found and used the git executable, it looked in the wrong directory for the repository.
No matter if the file was opened from Windows with the mouse in gvim, or via cmd.exe in vim.
Removed the AutoRun String from the registry and all was fine. Executables that are listed in the PATH variable still can be found, but the working dir is wrong through being forced. (That is my explanation from my observations just 2 mins ago.)
精彩评论