I'm attempting to copy and paste a file to a previous directory without using files paths.
Here's what i mean:
Set-Clipboard File.bat
cd ..
cd ..
cd ..
write-output | get-clipboard
Then I go to check and it's not there, what am i missing??
Thanks.
I think using Set-Clipboard will only copy the name of the file to the clipboard.
Why not get the file into a variable and the copy that into the new location after you change directories:
$file = Get-ChildItem .\File.bat
cd ..
cd ..
cd ..
$file | Copy-Item