# remove comma in a string



## hs2008 (May 27, 2011)

i have a bat file that check remote server space and the results coming with comma, how can i remove the comma so i can use math function.

my code:
@echo off
dir \\server-name\os |find "free" >c:\scripts\cmd\output\space.txt
for /f "tokens=3" %%v in (c:\scripts\cmd\output\space.txt) do set space=%%v
echo %space%
------- 
the results are x,xxx,xxx,xxx and i would like it xxxxxxxxxx

Thanks Hs2008


----------



## Squashman (Apr 4, 2003)

```
C:\WINDOWS\system32>set space=32,333,123

C:\WINDOWS\system32>echo %space%
32,333,123

C:\WINDOWS\system32>set space=%space:,=%

C:\WINDOWS\system32>echo %space%
32333123
```


----------



## Squashman (Apr 4, 2003)

You can also shorten up your for loop to this.

```
for /f "tokens=3" %%v in ('dir ^|find "bytes free"') do set space=%%v
```


----------

