I’ve got the following code, but when it is executed there are problems with the quotes: the substring methods need to use :=”, but I don’t know how to combine them with for example :~0,9.
SETLOCAL enabledelayedexpansion
set var=%1
if %var:~0,9%=="phpfile:/" (
set url = %var:~9%
) else (
set url = %var:~10%
)
if "%var:~-1%"=="\" (
set url = %url:~0,-1%"
)
if "%var:~-1%"=="/" (
set url = %url:~0,-1%"
)
START "" "C:\Program Files (x86)\NuSphere\PhpED\7.0\phped.exe" %url:"=%
There are some syntax bugs in your code.
Don’t add spaces in
SETstatements, else you got variable names with spacesurl<space>instead ofurl.The
if %var:~0,9%=="phpfile:/" (must be quoted, else the parser will not work as expected.The trailing quote at
set url = %url:~0,-1%"will add a quote at the end, I suppose you need something likeset "url=%url:~0,-1%"