How to assign cmdlet output to a variable and How to use a variable with saved output

Table of contents How to save cmdlet output to a variable How to display the contents of a variable in Terminal How to process the contents of a variable using a cmdlet How to count the number of rows in a variable How to get an idea of ​​the contents of a variable without printing […]

How to determine an object’s type in PowerShell

Table of contents 1. How to determine an Object's type in PowerShell 2. Determining the object type with .GetType() (as well as .GetType().Name and .GetType().FullName 3. How to get the object type with Get-Member 4. Checking object types with the -is and -isnot type operators 5. How to check the type of collection elements 6. […]

How to display the full user name in a domain and workstation in PowerShell and CMD

Contents 1. How to find the full name of a user on the local computer 1.1 net user $env:USERNAME 1.2 Get-WMIObject Win32_UserAccount 1.3 [adsi] 1.4 Displaying the user name in CMD 1.5 Full user name in the Windows registry 2. How to get the current Windows user display name from the command line (for computers that are […]

How to add a ‘b’ prefix to a variable name in Python?

Strings with a ‘b’ prefix in Python Consider the following example: byte_string = b'test string' print(byte_string) These two strings will print: b'test string' Strings with a ‘b’ prefix are a sequence of bytes, i.e. a special type of data (such as strings, numbers, lists, etc.). Suppose we want to do something like this: variable_string = […]

PowerShell: how to find only folders with Get-ChildItem

This post will show you how to list only folders and subfolders of a specific directory in PowerShell. We will use the Get-ChildItem cmdlet, which shows the children of a selected drive or directory. How to list only folders in Get-ChildItem To list only folders without files in PowerShell, use the Get-ChildItem cmdlet with the […]

How to find large files in PowerShell (using Get-Childitem)

This tutorial will tell you how to find large files (more than 2GB, 3GB, 10GB, or any other size). And also how to list large files in PowerShell. To find files, we will use the Get-Childitem cmdlet. This cmdlet gets elements and child elements in one or more specified locations. The description of the cmdlet […]

In-RAM filesystem to speed up file handling and reduce disk load (tmpfs)

Table of contents 1. What is tmpfs 2. What can tmpfs be used for 3. How to use tmpfs 4. Interface (script) for working with tmpfs (virtual memory filesystem) 4.1 Download the script for working with tmpfs (tmpfs-mounter) 4.2 tmpfs-mounter options 4.3 tmpfs-mounter usage examples Conclusion This guide will tell you about tmpfs: how to […]

Hashtables in PowerShell (strings that start with @) (complete guide)

Table of Contents 1. What are Hashtables in PowerShell 2. What are hashtables used for? 1) Storing data 2) Cmdlet options 3) Formatting output 4) Converting to JSON 3. Syntax for creating hashtables 4. Why the order of keys is not maintained in the hashtable. How to create an ordered hashtable 5. How to output […]

An analogue of cd and chdir in PowerShell. How to change the current working folder in PowerShell

Why change the working folder in the command line The current folder (or working folder) is the location in the file system where the user is located when working in the Terminal. Strictly speaking, each running process has its own working folder (at startup, it coincides with the folder where the file or script that […]

Loading...
X