| ||
Here is my latest stab at this, with some more comments below...
:: ** please customize the 'set ZTW=' line below with your ZTreeWin command line **
@if not ["%~1"]==[%1] call :sendToZTree "%*" & goto :eof
:sendToZTree
set ZTW=C:\ZTree\ZTW.exe /TO /T"*ANSI*" /O
if [%a1:~0,1%]==[d] ( This appears to work, to the extent that batch files can possibly work as "send to" targets. In particular, the limitations that I am currently aware of are: (a) Explorer does not quote pathnames which include caret "^" characters; the cmd command line processor escapes those before passing them on to the batch file, so by the time the arguments are read in the batch file the carets are lost for good and not recoverable. (b) Explorer does not quote pathnames with special characters which are parsed as argument delimiters by cmd (e.g. comma ",", semicolon ";", equal "=" and possibly others). This makes it difficult to recognize command lines with a single path vs. those with multiple paths (such as when "send to" is invoked on a multiple selection). For example, both "some.bat 1 2 3" and "some.bat 1,2;3" parse argument %1 as "1", %2 as "2" and %3 as "3". The .cmd above assumes one single argument, and will fail with an error if that's not the case. (c) Pathnames with characters not present in the ANSI codepage will not open, the same way that they would not open in ZTW /O if navigated to manually. I was not able to find a way to detect that case in batch code, so there would be ZTree error(s) popping, instead. > I've tried %p1:,=,COMMA,% but it doesn't work [...] With delayed expansion enabled, !p1:,=,COMMA,! seems to work as expected. > Next time (if time) I'll try an internal "call Label %*" and I took a similar shortcut of always adding the enclosing quotes, if missing.
Cheers, | ||
|
Messages in this Thread
- [Tip] useful batch "ZtSendTo" (1,007) - Hartmut Schneider - Dec 12,2007 at 00:03 [Tip]
- remove trailing spaces! (861) - Hartmut Schneider - Dec 12,2007 at 03:11
- Two methods to go to focussed directory (but not file) (974) - Tom Foote - Dec 12,2007 at 09:21
- Another take on it when CO-3K = yes (807) - Liviu - Dec 12,2007 at 09:45
- exist %1\nul - thanks (810) - Hartmut Schneider - Dec 12,2007 at 12:04
- exist %1\nul - thanks (895) - Liviu - Dec 12,2007 at 12:43
- %s1\nul - unreliable? (897) - Hartmut Schneider - Dec 13,2007 at 01:06
- how about... (822) - Liviu - Dec 13,2007 at 04:23
- %s1\nul - unreliable? (897) - Hartmut Schneider - Dec 13,2007 at 01:06
- exist %1\nul - thanks (895) - Liviu - Dec 12,2007 at 12:43
- exist %1\nul - thanks (810) - Hartmut Schneider - Dec 12,2007 at 12:04
- improved version 2 (947) - Hartmut Schneider - Dec 13,2007 at 03:29
- improved version 2 (867) - Liviu - Dec 13,2007 at 04:28
- different guess (865) - Hartmut Schneider - Dec 14,2007 at 03:02
- different guess (1,442) - Liviu - Dec 14,2007 at 07:23
- different guess (865) - Hartmut Schneider - Dec 14,2007 at 03:02
- Alternate[?] link for test.exe (877) - Doug Borg - Dec 13,2007 at 10:15
- thanks, adopted (nomsg) (831) - Hartmut Schneider - Dec 14,2007 at 02:32
- improved version 2 (867) - Liviu - Dec 13,2007 at 04:28
- final version 2c (954) - Hartmut Schneider - Dec 17,2007 at 21:00
- remove trailing spaces! (861) - Hartmut Schneider - Dec 12,2007 at 03:11