In my project I have a piece of code which executes a command:
Remove-Item -path \\D$\folder_name\* -recurse -force
Is there some way to save the path into a variable?
Something like:
Remove-Item -path ${path} -recurse -force
You can create a variable like this:
$Path = "\\$\folder_name\*"
And then pass it to the Remove-Item cmdlet:
Remove-Item -Path $Path -Recurse -Force
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.