TopMiniSite
- 3 min readIn PowerShell, you can read a multiline string in an Excel cell by using the COM object model to interact with the Excel application. You can access the contents of a cell as a string and then process it as needed. You can also use the $xlRange.Text property to read the entire contents of a multiline cell as a single string, including newline characters.
- 4 min readTo run a script on a server using FastAPI, you first need to create a FastAPI application that will serve as the server. You can define endpoints in your FastAPI application that will execute the script when the endpoint is called.Next, you need to create the script that you want to run on the server. This script can be written in any language that the server supports.
- 5 min readTo get the current path in FastAPI with the domain, you can use the request object provided by FastAPI. Here is an example of how you can do this: from fastapi import FastAPI, Request app = FastAPI() @app.get("/") async def get_current_path(request: Request): current_path = request.url.path current_domain = request.url.
- 7 min readAfter editing a file in PowerShell, you can store it by using the Set-Content cmdlet. This cmdlet allows you to overwrite the existing file with the edited content or create a new file with the edited content. Simply use the following syntax: Set-Content -Path "path/to/file.txt" -Value "edited content" Replace "path/to/file.
- 4 min readTo install FastAPI properly, you can use Python's package manager, pip. First, make sure you have Python installed on your system. Then, open a terminal or command prompt and use the following command: pip install fastapi This will download and install FastAPI and any dependencies it requires.
- 6 min readTo copy multiple files from multiple hosts in PowerShell, you can use the Copy-Item cmdlet with the -Path and -Destination parameters. First, you need to establish a connection to each host using the New-PSSession cmdlet. Then, you can use the Invoke-Command cmdlet to run the Copy-Item cmdlet on each host. This allows you to copy files from multiple hosts to a specified destination on your local machine.
- 4 min readIn FastAPI, you can request multiple files by using the UploadFile class from the fastapi library. To request multiple files, you can create a form parameter in your endpoint function that accepts a list of UploadFile objects. For example: from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/upload_files/") async def upload_files(files: List[UploadFile] = File(...)): for file in files: contents = await file.
- 4 min readTo convert a hex value to a version number in PowerShell, you can use the following code snippet: $hexValue = "1A2B3C4D" $intValues = for ($i = 0; $i -lt $hexValue.Length; $i+=2) {[Convert]::ToInt32($hexValue.Substring($i,2),16)} $versionNumber = [string]::Join('.', $intValues) In this code, replace the $hexValue variable with the hex value you want to convert.
- 6 min readTo compare two CSV files in PowerShell, you can read them in as arrays using the Import-Csv cmdlet, and then use the Compare-Object cmdlet to compare the data. You can specify which properties to compare and whether you want to see the differences in the first or second CSV file. For example, you can use the following syntax: $csv1 = Import-Csv file1.csv $csv2 = Import-Csv file2.
- 7 min readTo populate a cell in a CSV file using PowerShell, you can use the Import-Csv and Export-Csv cmdlets. First, import the CSV file using Import-Csv and store the data in a variable. Then, manipulate the data as needed and update the value of the specific cell. Finally, export the modified data back to the CSV file using Export-Csv. You can achieve this by using PowerShell scripting and leveraging the csv file as an object that can be easily manipulated.
- 4 min readTo read desktop notifications in PowerShell, you can use the Get-BalloonTip function. This function is part of the BurntToast module, which can be easily installed using the PowerShell Gallery. Once you have the module installed, you can use the Get-BalloonTip function to retrieve and display any desktop notifications that may be currently active on your system.