Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Batch Datei: Gesamt/Belegte Speicher eines Laufwerks

Empfohlene Antworten

Hi,

ich nutze in einer Batch Datei den "dir C: /-c" Befehl um den FREIEN Speicher als Bytes zu erhalten.

Aber wie bekomme ich (möglichst ohne Zusatztools, nur mit Hilfe der normalen unter Windows >= XP), den GESAMTEN, oder den BELEGTEN Speicher eines Laufwerks? (kann man ja umrechnen:-))

Gruß

Davidy

Mit einem VB-Script:

'--------------------------------------------------------------------

' Description

'--------------------------------------------------------------------


' Reports the size and free disk space of each drive from the current Computer


'--------------------------------------------------------------------

' Declarations

'--------------------------------------------------------------------


Option Explicit

'On Error Resume Next


const bytesToMB = 1048576

const bytesToGB = 1073741824

const bytesToTB = 1099511627776


'--------------------------------------------------------------------

' Variables

'--------------------------------------------------------------------


Dim strComputer: strComputer = "."


'---------------------------------------------------------------------

' Script

'---------------------------------------------------------------------


Dim objWMIService: Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Dim colItems: Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk")


Dim objItem

For Each objItem In colItems

	If objItem.Size > 1 Then

		If objItem.FreeSpace > 0 Then

			WScript.Echo objItem.Name & " " & ConvertToDiskUnit(objItem.Size) & " (" & ConvertToDiskUnit(objItem.FreeSpace) & " Free)"

		End If

	End If

Next


'---------------------------------------------------------------------

' Function

'---------------------------------------------------------------------


Function ConvertToDiskUnit(value) 

	IF (value/bytesToTb) > 1 THEN

		ConvertToDiskUnit = round(value/bytesToTB,1) & " TB"

	ELSEIF (value/bytesToGb) > 1 THEN

		ConvertToDiskUnit = round(value/bytesToGB,1) & " GB"

	ELSEIF	(value/bytesToMb) > 1 THEN

		ConvertToDiskUnit = round(value/bytesToMB,1) & " MB"

	ELSE

		Exit Function

	END IF

End Function

Für den belegten, kannst du ja den Freien vom Totalen abziehen.

Guss,

tester2k5

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.