Loading |
VBScript |
JavaScript |
Powershell |
Search Options: GetDriveSizeContent of GetDriveSize.jsMD5 Hash: 134C47896FDDAC9C842834D17C733FAC |
||
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).totalsize,iround); break; case 2 : vdrivesize = round((ofso.getdrive(sdrive).totalsize/1024),iround); break; case 3 : vdrivesize = round(((ofso.getdrive(sdrive).totalsize/1024)/1024),iround); break; case 4 : vdrivesize = round((((ofso.getdrive(sdrive).totalsize/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 :: |