Convert string to int

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
harishkothuri
Posts: 1
Joined: 24 Aug 2011 00:57

Convert string to int

#1 Post by harishkothuri » 24 Aug 2011 01:00

Hi , I want to convert string to an interger in batch program, Please help.

Thanks,
Harish

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Convert string to int

#2 Post by Ed Dyreen » 24 Aug 2011 02:23

'
Batch only knows one type of variables :$variable STRING, basically a memory pointer.

Code: Select all

set /a "$var=1" :: string
set    "$var=1" :: string
It sucks yes I know, you won't be doing this in batch:

Code: Select all

procedure MyProcedure
var
   MyVar1:integer;
   MyVar2:string ;
begin
   MyVar1 :=  1 ;
   MyVar2 := '1';
End;

Post Reply