Code for Assigning the Name of a File in a Specific Folder to a String Variable
I would like to capture the name of a specific file in specific folder in a string variable (MyString) such that the string variable contains only the first two words in the name of the document and does not include the full path of the file or the file extension. To explain it a little further
If I have a file C:\Important Files\Investigation Results.doc
I would like MyString to be equal to Investigation Results
If I have a file C:\Important Files\Test Results\Blood Results.doc
I would then like MyString to be equal to Blood Results
Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!