andrew Black wrote: > $Bill Luebkert wrote: > > >>Did a little searching and came up with this to replace the above 2 lines : >> >> for /F "usebackq" %%i in (`perl find_dir.pl %1`) do cd %%i >> > > Cheers - that does the trick. I was trying to look for a way of > putting the result of a command into a variable. > > A slight refinement I found I needed - the above version stumbled on > files involving spaces ... > for /F "usebackq delims=," ....... as before > I am assuming the "," is not a valid character in a filename.
You could use '?' (wildcard char - can't be in a filename). Note that cd on Windoze won't cross disk boundaries, so to be really useful, you should have a way to change drives if necessary. This seems to handle it but there ought to be a way to do it with one line instead of 2 : @echo off for /F "usebackq" %%I in (`perl E:\home\dbe\test.pl %1`) do %%~dI for /F "usebackq delims=?" %%J in (`perl E:\home\dbe\test.pl %1`) do cd %%J -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff) _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
