I want to write a batch file that allows me to search a name in CMD for example if I write this command in CMD search c:new folder s
every files that has s in the name of it should be listed like see saw or anything else.
If just you want to run the command as a batch, you can simply type the same into the batch program and run it.
In case you want to hard code the dir
dir /a-d "c:new folder*s*"
In case you want to supply it as a parameter. In this case enclose the c:new folder*s* in the ". Say batch file is test.bat, then run it as test "c:new folder*s*"
dir /a-d %1
If you are trying to capture the result, you may want to pipe it to some file, like
dir /a-d "C:new folder*s*" > mysearch.txt
Thanks to rizvisa1 for this tip on the forum.