Author: Alex

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 part of a domain) 2.1...

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 = "test string" byte_string = b'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 -Directory option. For example, 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 is quite convoluted – the...

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 create a tmpfs filesystem; this...

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 the contents of a hashtable...

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 launched this process is located,...

How to clear the terminal window in PowerShell. Analog of clear

When debugging cmdlets and options, so that previously output data does not fall into the field of view and does not mix with the results of the last command, or if for other reasons you want to delete everything that the command line utilities output, then you can use this instruction. We will consider such questions as: 1) How to...

How to find out the current directory in the Windows command line. Analog of pwd in PowerShell

What is the current and working directory in Windows The current directory or working directory is a folder relative to which the names of files whose path is specified relative or not specified at all are determined. Let's say the current directory is the folder “C:\Users\MiAl”. Therefore, if I create a file test.txt without specifying an absolute path, this file...
Loading...
X