Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  GetFreeDriveSize  

 Content of GetFreeDriveSize.js
MD5 Hash: DF75B2B9013A45D55208E1CF5DAE86CF
WScript.Echo(getdrivesize("c:", 1, 2) + " Bytes");
WScript.Echo(getdrivesize("c:", 2, 2) + " KB");
WScript.Echo(getdrivesize("c:", 3, 2) + " MB");
WScript.Echo(getdrivesize("c:", 4, 2) + " GB");


// -------------------------------------------
function getdrivesize(sdrive, iformat, iround)
{

var vdrivesize;
var bobjectcreate = false;

if (ofso == null)
{
var ofso = new ActiveXObject("scripting.filesystemobject");
bobjectcreate = true;
}

if (ofso.driveexists(sdrive))

{
switch (iformat)

{
case 1 :
vdrivesize = round(ofso.getdrive(sdrive).freespace,iround);
break;

case 2 :
vdrivesize = round((ofso.getdrive(sdrive).freespace/1024),iround);
break;

case 3 :
vdrivesize = round(((ofso.getdrive(sdrive).freespace/1024)/1024),iround);
break;

case 4 :
vdrivesize = round((((ofso.getdrive(sdrive).freespace/1024)/1024)/1024),iround);
}
}
else
{
if (ofso && bobjectcreate)
{
ofso = null;
}
return -1;
}

if (ofso && bobjectcreate)
{
ofso = null;
}

return vdrivesize;
}

// ---------------------
function round(num, dec)
{
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;
}

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a