- Install .NET 10 (Latest Version) in this Link.
- To run the scripts need to use the following command:
dotnet run <name-script>.cs- To verify the location of the Powershell file run the following command:
$PROFILE. - Open the file in an text editor.
- Add the following function inside the file.
function control-hours {
$filePath = (Get-ChildItem -Path "C:\Users\" -Recurse -Filter WorkTime.cs -ErrorAction SilentlyContinue | Select-Object -First 1).FullName
if (-not $filePath) {
Write-Host "File WorkTime.cs not found!" -ForegroundColor Red
return
}
dotnet run $filePath
}
New-Alias ch control-hours- This code is going to look for the file
WorkTime.csinto your computer and when found it's going to run with dotnet.
I'll let the complete example of the functions to copy and paste into your powershell configuration.