To search for words within a file in Windows 10 command line, use the following syntax: strComputer = "." strFile = "C:\\Users\\YourUserName\\Documents\\SampleFile.txt" sSearchText = "search text" If the file doesn't exist, Windows will create it and open it for you.