Skip to main content
infervour.com

infervour.com

  • How to Count Files In Folder And Subfolder Using Powershell? preview
    3 min read
    To count files in a folder and its subfolders using Powershell, you can use the following command: (Get-ChildItem -Recurse -File -Path "C:\Path\To\Folder" | Measure-Object).Count Replace "C:\Path\To\Folder" with the actual path to the folder you want to count the files in. This command will recursively count all the files within the specified folder and its subfolders.

  • How to Do A Looping to Check A Match String Using Powershell? preview
    5 min read
    In PowerShell, you can use a loop to check if a string matches a specific pattern or value. One way to do this is by using a foreach loop to iterate through a collection of strings and checking each one for a match using a conditional statement such as an if statement or a regular expression. You can also use a for loop or a while loop depending on your specific requirements. It is important to ensure that the loop continues until a match is found or until all strings have been checked.

  • How to Execute A Oracle Sql Script Form Local Machine Using Powershell preview
    6 min read
    To execute an Oracle SQL script from a local machine using PowerShell, you can use the Oracle Data Provider for .NET (ODP.NET) to connect to the Oracle database and run the script. First, you need to install the Oracle Data Provider for .NET on your local machine. Then, you can use a PowerShell script to connect to the Oracle database and execute the SQL script. This script can include commands to establish a connection, read the SQL script file, and execute the SQL commands within it.

  • How to Write A Powershell File Parameter That Accepts A Relative Path? preview
    6 min read
    To write a PowerShell file parameter that accepts a relative path, you can define the parameter with the [System.IO.Path]::GetFullPath() method. This method converts the relative path into an absolute path, allowing you to work with it in your script. By using this approach, you can ensure that the input path is valid and properly resolved, regardless of the current working directory.

  • How to Write All Powershell Screen Output to .Csv Report File? preview
    5 min read
    To write all PowerShell screen output to a .csv report file, you can redirect the output from the screen to a file using the ">" operator. This operator allows you to send the output to a file instead of displaying it on the screen.For example, you can use the following command to run a PowerShell script and save the output to a .csv file:.\myscript.ps1 > output.csvThis will run the script myscript.ps1 and save the output to a file named output.csv. You can then open the .

  • How to Scan Through All the Rows And Split Into Different File Using Powershell? preview
    4 min read
    To scan through all the rows and split into different files using PowerShell, you can use a script that reads the input file row by row, applies a condition to determine which file to write each row to, and then writes the row to the appropriate output file. You can create a loop that reads each row of the input file, checks the condition for that row, and then writes it to the corresponding output file based on the condition.

  • How to Stop Powershell Rounding Numbers Off? preview
    4 min read
    In PowerShell, when working with numbers, the default behavior is to round off decimal numbers to a certain precision. This is often done to make the output more readable and concise. However, if you want to prevent PowerShell from rounding off numbers, you can use the [math]::truncate method to truncate the number to the desired precision without any rounding.For example, if you have a decimal number like 3.

  • How to Pass Parameters to Powershell Script From Batch File? preview
    4 min read
    To pass parameters to a PowerShell script from a batch file, you can use the following syntax:In the batch file, call PowerShell with the script file and pass the parameters using the -File flag. For example: powershell -File "C:\path\to\script.ps1" -Parameter1 "value1" -Parameter2 "value2" In your PowerShell script, you can access the passed parameters using the $args or named parameters.

  • How to Compare File Size For Copied Files In Powershell? preview
    4 min read
    In PowerShell, you can compare the file size of copied files by using the "Get-Item" cmdlet to retrieve information about the original file and the copied file. You can then access the "Length" property of the files to get their sizes and compare them to see if they match. Additionally, you can use conditional statements like if-else to determine if the file sizes are the same or not.

  • How to Fix Error: Spawnsync Powershell.exe Enoent? preview
    8 min read
    To fix the error "spawnsync powershell.exe ENOENT," you can try the following solutions:Check if powershell.exe is installed in your system and the path is included in the system's PATH variable.Reinstall Node.js to ensure that all necessary binaries and executables are properly installed.Update NPM to the latest version to ensure compatibility with the Node.js version you are using.Use an absolute path to powershell.

  • How to Get Xml Node Attribute Values In Powershell? preview
    4 min read
    To get XML node attribute values in PowerShell, you can use the Select-XML cmdlet along with XPath expressions to select specific nodes and their attributes from the XML file. Once you have selected the desired node, you can access its attributes using the XML DOM methods like GetAttribute() and Value. By retrieving the attribute values, you can store them in variables or use them for further processing within your PowerShell script.