Scripting Question
Posted: Thu Sep 20, 2018 7:37 am
hello
Sorry my english is not so good
i have a question / problem with the browse folder function
when i choose a folder and set a variable with this folder , adding a subfolder the path is ok
$Back_Rec_Path = $folderbrowserdialog2.SelectedPath
$global:DestPath = $Back_Rec_Path + "\BACKUP\" + $Env:USERNAME # zb.: C:\Backup\Username...
the $destpath variabe is then ok, like d:\test\backup\
but when i choose a root drive like d:\ the $destpath is d:\\backup
now i have to backslash
what i make wrong
a solution was the following
The following is a safe way to join multiple path segments.
$global:DestPath = [system.io.path]::Combine($Back_Rec_Path.'BACKUP',$Env:USERNAME)
But this only works with powershell 5
it not working with v2 what is most installed on our win 7 clients
how i mus t change the script to run in v2
thx
Peter
Sorry my english is not so good
i have a question / problem with the browse folder function
when i choose a folder and set a variable with this folder , adding a subfolder the path is ok
$Back_Rec_Path = $folderbrowserdialog2.SelectedPath
$global:DestPath = $Back_Rec_Path + "\BACKUP\" + $Env:USERNAME # zb.: C:\Backup\Username...
the $destpath variabe is then ok, like d:\test\backup\
but when i choose a root drive like d:\ the $destpath is d:\\backup
now i have to backslash
what i make wrong
a solution was the following
The following is a safe way to join multiple path segments.
$global:DestPath = [system.io.path]::Combine($Back_Rec_Path.'BACKUP',$Env:USERNAME)
But this only works with powershell 5
it not working with v2 what is most installed on our win 7 clients
how i mus t change the script to run in v2
thx
Peter