This seems to be a trivial question and has been answered several times. Nevertheless, I do not understand.
Is there one command to move an item (or just rename it as the source and destination are in the same folder) with forced rewriting that works for any type of item (sheet, container)?
Reference Information. I am writing a script that replaces all hard links and connections with the corresponding corresponding symbolic links. Code example:
mkdir C:\Temp\foo -ErrorAction SilentlyContinue
'example' > C:\Temp\foo\bar.txt
cd C:\Temp
New-Item -ItemType Junction -Name bar -Target C:\Temp\foo
New-Item -ItemType SymbolicLink -Name bar2 -Target '.\foo'
Rename-Item -Path 'C:\Temp\bar2' -newName 'bar' -force
Move-item -Path 'C:\Temp\bar2' -destination 'C:\Temp\bar' -force
[IO.Directory]::Delete('C:\Temp\bar')
Rename-Item -Path 'C:\Temp\bar2' -newName 'bar'
source
share