vbscript -> C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nicopilami

    vbscript -> C#


    Hello
    i try to do convert the following code into c# but i don't succeed
    because the c# function DriveInfo do not seem to support UNC path...
    am i wrong ?

    ' VB Script Document
    Dim fso : Set fso = CreateObject("S cripting.FileSy stemObject")
    totalSize=Int(f so.GetDrive("\\ server\shared$" ).TotalSize)
    freeSpace=Int(f so.GetDrive("\\ server\shared$" ).FreeSpace)
    usedSpace=total Size-freeSpace
    percentage=used Space/totalSize*100
    MsgBox percentage


    could you convert it for me ?
    bye
    Nico
  • Jason Newell

    #2
    Re: vbscript -> C#

    I'd suggest option #1 of this blog.



    Jason Newell


    Nicopilami wrote:
    Hello
    i try to do convert the following code into c# but i don't succeed
    because the c# function DriveInfo do not seem to support UNC path...
    am i wrong ?
    >
    ' VB Script Document
    Dim fso : Set fso = CreateObject("S cripting.FileSy stemObject")
    totalSize=Int(f so.GetDrive("\\ server\shared$" ).TotalSize)
    freeSpace=Int(f so.GetDrive("\\ server\shared$" ).FreeSpace)
    usedSpace=total Size-freeSpace
    percentage=used Space/totalSize*100
    MsgBox percentage
    >
    >
    could you convert it for me ?
    bye
    Nico

    Comment

    • Nicopilami

      #3
      Re: vbscript -> C#

      On 16 juin, 18:14, Jason Newell <nos...@nospam. comwrote:
      I'd suggest option #1 of this blog.
      >

      >
      Jason Newellwww.jason newell.net
      >
      Nicopilami wrote:
      Hello
      i try to do convert the following code into c# but i don't succeed
      because the c# function DriveInfo do not seem to support UNC path...
      am i wrong ?
      >
      ' VB Script Document
      Dim fso : Set fso = CreateObject("S cripting.FileSy stemObject")
      totalSize=Int(f so.GetDrive("\\ server\shared$" ).TotalSize)
      freeSpace=Int(f so.GetDrive("\\ server\shared$" ).FreeSpace)
      usedSpace=total Size-freeSpace
      percentage=used Space/totalSize*100
      MsgBox percentage
      >
      could you convert it for me ?
      bye
      Nico
      ok, i'll try tomorrow :o)
      thx
      see you

      Comment

      Working...