Author: Arpit Mandliya
- 14 February
Set Environment Variable in PowerShell
Windows Environmental Variables and Their Scope There are three different scopes for environment variables in Windows. Set the Session Environment Variable Set an Environment Variable for a User Using PowerShell Set the Machine Environment Variable Before moving towards solutions, we must know the environment variables and why we use them. System administrators can access a […]
- 14 February
Check if String Contains Number in PowerShell
Using Regular Expression We use regular expressions whenever we are required to look for specific patterns in the text. The regular expressions, also known as regex, comprise operators, literal characters, and other constructs. PowerShell has various cmdlets and operators that allow us to use regex with them; some of them are given below: Using -match […]
- 14 February
PowerShell – Split String into Variables
Using Split() Method Use the Split() method to split the given string into two variables. [crayon-68bad286eac29516508347/] [crayon-68bad286eac3c655344342/] The Split() method is used to split the specified string into two/multiple variables and an array of substrings. In the above example code, the Split() method took two arguments, whitespace as a separator (you can use -, ., […]
- 14 February
Merge Multiple CSV Files in Python
Using pd.concat() Method To merge multiple CSV files in Python: Create a list containing all CSV files we will merge. Create an empty dataframe. Use the for loop to iterate over the files. In each iterate, use read_csv() to read CSV files and concatenate using the pd.concat() method. Use to_csv() to write merged data into […]
- 14 February
Compare Arrays in PowerShell
In this post, we will see how to compare Arrays in PowerShell. PowerShell supports arrays with one or more dimensions and zero to many elements in each dimension. Elements inside a dimension are numbered from 0 in ascending integer order. In addition, the array subscript operator [] allows access to any particular element. PowerShell may […]
- 14 February
Create Temp Directory in PowerShell
Using [System.IO.Path]::GetTempPath() Method with New-Item cmdlet Use the [System.IO.Path]::GetTempPath() with New-Item cmdlet to create a temporary directory in PowerShell. [crayon-68bad286eb8a9262331301/] [crayon-68bad286eb8ad648359634/] First, we used the GetTempPath() method of the System.IO.Path class to get the path of a current user’s temporary folder. This method returned a string type value, which we stored in the $temporaryPath variable. […]
- 14 February
Remove Character from String in PowerShell
Remove Character from String in PowerShell Using Replace() Method Use the Replace() method to remove character from a string in PowerShell. Replace() method replaces old character with new Character in the String. [crayon-68bad286eb9ee007580756/] [crayon-68bad286eb9f1156085512/] For the above code, we used the Replace() method to replace Character a with empty space which eventually remove character from […]
- 14 February
Count Files in Directory in Java
Using java.io.File Class Before moving forwards, it is important to know the available items in the current directory. You may also create the same structure to follow along with this article. Our current directory (E:\Test) has the following structure: E:\Test – It has seven items, four text files and three folders (FolderA, FolderB, FolderC, File1.txt, […]
- 14 February
Count Occurrences of Character in String in PowerShell
Using the -replace Operator To count the occurrences of a character in a String in PowerShell: Use the -replace operator to replace the occurrences of the specified character with an empty string and store the result in a temporary string. Use the .Length property to get the length of the original and the temporary string. […]