Search found 3 matches

by aijelt
03 Apr 2014 15:37
Forum: DOS Batch Forum
Topic: String manipulation using environment variables
Replies: 4
Views: 3964

Re: String manipulation using environment variables

Here it is, the finished code. That is... The first-name and last-name are set using a different piece of batch-file but this is working. I've left the strLen function out as it can be found here rather easy. cls @echo off set usg_firstname=Jon set usg_lastname=Williams call :strlen usg_firstname us...
by aijelt
03 Apr 2014 15:08
Forum: DOS Batch Forum
Topic: String manipulation using environment variables
Replies: 4
Views: 3964

Re: String manipulation using environment variables

Thanks guys! You rock. The ideas you posted I had tried before in many versions. Now, I pasted the code you guys put up here in my batch file. Again, your code works, mine didn't. What went wrong? Well... it's all in the details. It with great shame I have to admit that I forgot one % sign in my cod...
by aijelt
03 Apr 2014 10:42
Forum: DOS Batch Forum
Topic: String manipulation using environment variables
Replies: 4
Views: 3964

String manipulation using environment variables

On this excellent site I've learned how to manipulate strings in DOS. A method that has been helping me a lot is the 'MID' equivalent: set short_string=%long_string:~0,5% However, now I don't want a fixed number of characters (the 5 in this case) but I want this value to be calculated: set chars=5 S...