I'm making a prompt loop in a batch file
I'm trying to read the input for commands and arguments.
Currently, I check the first 4 letters for open
, then I want to grab the next word which should be a filename to open.
I'm wanting to grab the text between spaces at index 1.
open file.txt
-> file.txt
I need something like an inverse of mid-string
mid-string: %input:~0,4%
- open file.txt
-> open
I honestly need %input:~5,-0%
to work! haha
%input:~5,-1%
works... Why not with a 0
instead of 1
?
It's too bad batch has no way of getting a string's length.
I found something that would get a string's length: How do you get the string length in a batch file?
I tried it with the code:
call :strlen length input
echo %input:~5,length%
It always parsed weird.