Lock a file without 3rd party tools, no changes to the file being locked and file can't even be copied
This PowerShell script is a quote from an answer to a similar question.
# Specify the file name
$fileName = "C:\myfile.txt"
# Open the file in read only mode, without sharing (I.e., locked as requested)
$file = [System.io.File]::Open($fileName, 'Open', 'Read', 'None')
# Wait in the above (file locked) state until the user presses a key
Write-Host "Press any key to continue ..."
$null = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
# Close the file
$file.Close()
Edit: quoting a very usefull comment:
While testing this I found that you can also just use
[System.io.File]::Open('c:\myfile.txt', 'Open', 'Read', 'None')
which will keep the file open until you close PowerShell