How to convert string to integer in PowerShell

后端 未结 5 689
走了就别回头了
走了就别回头了 2020-12-29 19:36

I have a list of directories with numbers. I have to find the highest number and and increment it by 1 and create a new directory with that increment value. I am able to sor

5条回答
  •  半阙折子戏
    2020-12-29 20:08

    Example:

    2.032 MB (2,131,022 bytes)

    $u=($mbox.TotalItemSize.value).tostring()
    
    $u=$u.trimend(" bytes)") #yields 2.032 MB (2,131,022
    
    $u=$u.Split("(") #yields `$u[1]` as 2,131,022
    
    $uI=[int]$u[1]
    

    The result is 2131022 in integer form.

提交回复
热议问题