• Download File from URL in PowerShell
    13 March

    Download File from URL in PowerShell

    Using Invoke-WebRequest Cmdlet Use the Invoke-WebRequest cmdlet to download the specified file from the specified URL to the local path in your machine. [crayon-676957f860cbb864721540/] First, we created two variables named $URL and $LocalPath containing a URL and the local path of your machine. Note that variables are prefixed with the $ sign in PowerShell. Next, […]

  • Remove Non-alphanumeric Characters in Python
    11 March

    Remove Non-alphanumeric Characters in Python

    1. Overview Non-alphanumeric characters are those that are not letters or numbers, such as punctuation marks, symbols, spaces, or special characters. Sometimes, we may want to remove these characters from String in Python, for example, to clean user input, extract data etc. 2. Introduction to Problem Let’s say we have a string: [crayon-676957f8617e1837022664/] As we […]

  • Check number of arguments in Bash
    11 March

    Check Number of Arguments in Bash

    1. Overview In Bash scripting, it’s often necessary to verify the number of arguments passed to a script to ensure correct script execution. This is crucial in scenarios where the script’s behavior depends on user-provided inputs. In this article, we will see different ways to check number of arguments in bash. 2. Introduction to Problem […]

  • Delete Files older than X days in PowerShell
    11 March

    Delete Files Older than X Days in PowerShell

    Delete Files Older than X Days in PowerShell Use Remove-Item cmdlet with the Get-ChildItem cmdlet and Where-Object cmdlet to delete files older than X days. [crayon-676957f86298e613773103/] The above script retrieved all the items from the given path, filtered them based on the specified property and kept only those files/folders that were less than the given […]

  • Ping List of Computers in PowerShell
    10 March

    Ping List of Computers in PowerShell

    Different Ways to Ping a List of Computers in PowerShell There are multiple ways that we can use to ping a list of computers in PowerShell. Now, what does ping means? Pinging a computer means determining if the networked computer is available and responsive. If the networked computer (we can also call it a target […]

  • Convert Array Object to String in PowerShell
    10 March

    PowerShell Array to String

    Using Double Quotation Marks Use double quotation marks to convert array object to string in PowerShell. [crayon-676957f862d27601742848/] [crayon-676957f862d2b037380048/] First, we created an array object and saved it in the $arrayObject variable; we can also create an array object using the array operator (@()), for instance, $arrayObject = @("How", "are", "you?"). Next, we enclosed the $arrayObject […]

  • Return value from function in PowerShell
    08 March

    Return Value from Function in PowerShell

    Using the return Keyword PowerShell allows us to use the return keyword to return single or multiple values from a function. Let’s learn both of the scenarios. Use the return Keyword to Return a Single Value To return a single value from a particular function: Create a function that returns something, a string, a number […]

  • Check if String is null or empty in PowerShell
    08 March

    Check if String is Null or Empty in PowerShell

    Using -not and -eq Operators Use the -not operator to check if the string is null or empty in PowerShell. [crayon-676957f863137151921140/] [crayon-676957f86313a358601487/] First, we declared the $string variable and initialized it with $null. What is $null? It is an automatic variable in PowerShell representing the NULL value. Now, what is NULL? We can think of […]

  • Read File without newline in Python
    08 March

    Read File without Newline in Python

    Read File without NewLine in Python In Python, there are multiple ways to read a file without new lines, but before diving into those methods, let’s look at the .txt file we will use for this article. [crayon-676957f863365852921188/] You can follow along using the file.txt or your own file. Use read() and replace() Methods To […]