Redzarf
Redzarf

Reputation: 2699

DOS batch argument substring in one line

I have a batch file with the following 2 lines and change them into one line of code:

set arg=%1%
"C:\Program Files\TextPad 6\TextPad.exe" -u "D:\www\%arg:~14,-1%"

The context is that I'm using a webpage url-handler as described on http://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx

Currently I'm doing it by setting the batch file as the url command, so the %1 is passed into that, then converted and then it runs the text-editor. But I'd rather do it all in the url command, so that I don't have to use the batch file any more.

Upvotes: 1

Views: 1037

Answers (1)

wmz
wmz

Reputation: 3685

After much trial & error, I found this works:

cmd.exe /v:on /c set arg=%1& start /D"C:\Program Files\TextPad 6" TextPad.exe "D:\www\!arg:~14,-1!"

Upvotes: 4

Related Questions