Commands similar to lsblk on Linux in a Windows environment

Asked 2 years ago, Updated 2 years ago, 138 views

Hello.

The Linux terminal has a command called lsblk. If you run the command, you will get the following results:

NAME MAJ:MINRM SIZE RO TYPE MOUNTPOINT
sda      8:0    0    64G  0 disk 
├─sda1   8:1    0    63G  0 part /
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0  1022M  0 part [SWAP]
sr0     11:0    1  1024M  0 rom  
sr1     11:1    1  1024M  0 rom  

Using the above command, Linux was able to configure a script to automatically install a new operating system, etc., formatting and partitioning the current PC-connected storage device (even though the file system cannot be read).

When you try to move that content to Windows, there is a command in the cmd window that checks for physically connected storage devices, even if the file system cannot be read like that (even if it is not mounted.

Thank you.

windows command-line-argument lsblk

2022-09-22 13:41

1 Answers

I think I can do a similar trick using a power shell.

First, run it in POWERSHELL as follows:

Get-WmiObject -Class Win32_Volume

Or

gwmi win32_volume

The associated disk information can be viewed by changing to win32_disk instead of win32_volume.

It doesn't show in a table form like Linux, but it shows each item in a list form.

I think we can make it like a table using powershell as follows.

gwmi win32_volume | sort {$_.name} | foreach-object { echo "$(echo $_.name) $(echo $_.FileSystem) [$(echo $_.label)]" }


2022-09-22 13:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.