Page 1 of 1

length should be 8 characters

Posted: 30 Aug 2007 02:39
by sivaram.nv

I refered this URL to find 8 characters but not working properly ... c128586394

My requirement is

set string=abcdefghijk (11 characters i have taken)

I need to count the 8 charactes only if it is more than 8 i need to skip

anybody can help me to sort out this issue

Thanks & Regards
Sivaram Nv

Posted: 30 Aug 2007 11:19
by sivaram.nv
Hi All

Please find solution for the below query

@echo off

REM the below mentioned str having more than 8 characters

set str=Sivaramnv

echo Given Queue Manager Nae %str%
set str1=%str:~0,8%
echo After 8 Strings the QM name is %str1%

set str2=%str%

set str2=%str2:~8%
echo After 8 Characters result of QM Name %str2%

set string01=%str1%
set string02=%str2%

set final_string=%string01%%string02%

echo total 2 strings(1st 8 and after 8) %final_string%

IF "%string02%" EQU "" GOTO START


echo 8 character Qmanager Name is %final_string%

echo You have exceeded more than 8 characters


Posted: 30 Aug 2007 14:11
by jeb

nice, but where do you have a problem?

Your batch results in

1) set str=12345678
8 character Qmanager Name is 12345678

2) set str=123456789abcd
You have exceeded more than 8 characters

Which results do you want? :?: