Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

quotes within quotes witha variable.

$
0
0

Hi all


I am having an issue where i need to add " within an output this is due to spaces in the names. If i do not add the " i get what i need but since there are spaces in the names this will fail here is the code. the $fold is a folder structure within a share we have. $itm is the names of the folders. i am creating a bat file to copy each folder individually from source to destination.

$Fold = get-content c:\scripts\folders.txt
foreach ($Itm in $fold)
{
Write-output "start robocopy "F:\Information Technology\$itm" "J:\Information Technology" /MIR /COPYALL /ZB /W:3 /R:3 /TEE /LOG:C:\robocopy-f-to-j_$itm.log" | out-file c:\scripts\robo\$itm.bat
}

I know there is a way with "test '"text here'" text "           but how do you do

  "text '"some text $variable'" some more text"


Viewing all articles
Browse latest Browse all 10624

Trending Articles