Usage of '#' (pound sign) in batch files

Viewed 4709

I've come across a batch file (portableshell.bat from the portable version of Strawberry Perl) that uses # and I can't understand why. I've searched online but there seems to be no reference to this usage. I need to imitate the batch file's functionality but I'm wary to do so without understanding what it does exactly.

What's the purpose of # here:

set drive=%~dp0
set drivep=%drive%
if #%drive:~-1%# == #\# set drivep=%drive:~0,-1%

and here:

if not #%1# == ## "%drivep%\perl\bin\perl.exe" %* & goto END

(here's a pastebin of the entire file, for reference)

1 Answers
Related