Search the Community
Showing results for tags 'split'.
Hi guys, I have the following PowerShell code; $FolderPath = "\\server\folder1\folder2\~folder3" $SplitFolder = $FolderPath -split '\\' I can then echo each split using; echo $SplitFolder server echo $SplitFolder folder1 echo $SplitFolder folder2 but when I get to echo $SplitFolder, because the folder name begins with a tilde (~), it fails; echo $SplitFolder Cannot index into a null array. At line:1 char:1 + echo $SplitFolder + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) , RuntimeException + FullyQualifiedErrorId : NullArray Any ideas why the -split fails to set the variable correctly, for the folder beginning with a tilde? Please note that I am planning on making the folder path an input from the user, so they may put in any path. Therefore, I cannot simply escape the one character, as it will be different each time. Thank you.
I was messing around with splitting down a wordlist and I must have cut it just right to where my computer reads it as a music file instead of text. I don't know much about how computers handle music files and my only thoughts are that some of the text is being read by the file system and tells Linux that the file is a music file. Nautilus shows the rythimbox icon instead of the text icon. If I change the file from xaaaaabcc to xaaaaabcc.txt it will show up as a text file. It is actually a text file. https://drive.google.com/open?id=0B8Mz8bu8fJ4kclk1M0ZYQnRDcHM Anyone want to look at this file and tell me what I did?