Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
$buttonBrowseFolder_Click = {
if ($folderbrowserdialog2.ShowDialog() -eq 'OK'){
$textboxFolder.Text = $folderbrowserdialog2.SelectedPath
$Back_Rec_Path = $folderbrowserdialog2.SelectedPath
Update-ListBox $ListBox1 "create Backup Directory / read Backup Directory" -Append
$global:DestPath = [system.io.path]::Combine($Back_Rec_Path,'BACKUP', $Env:USERNAME)
Update-ListBox $ListBox1 "create Log Folder / read Log Folder" -Append
$global:DestPathLog = $DestPath + "\!LOG" #
$global:LogFile = $DestPathLog + "\Robocopy_Profil_copy.txt"
If (!(test-path $DestpathLog)){ #sollte das Zielverzeichnis nicht vorhanden sein, läuft Robocopy wegen der LOG-Datei in einen Fehler...
New-Item -ItemType Directory -Force -Path $DestpathLog
}
}
}
I recommend running your code with the debugger to verify that you are getting the correct values. I see no way with this minimal example to determine what is causing your issue.
If "Test-Path" fails you are doing nothing. You need to do something when the path does not exist.
This topic is 5 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.