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
everyfile that has s in the name of it should be listed like see saw or anything else
if the 4 points i said were correct. then first the batch file needs to be called "search.bat" as you are typing Search.
The other thing is that the search.bat file should be in the same folder from where you are trying to run it. Other option would be the have the path where the search.bat resides added the environment variable "PATH"
One change to the code is needs as it seems that you are passing two parameters. One the director and the other the the characters of the file
Save the code below Search.bat in your root c:\
once save, type cmd
then type cd /d c:\
then run search file
search "c:\windows" "sys"
if %str%==\ GOTO MoveOn
dir /a-d %searchFor%
Well correct me where I am falling off.
1. you are using vista
2. when you say "cmd" you are talking about the command "cmd" that open a dos sort windows.
3. you would be typing in cmd and open the dos window
4. there you would be typing in command "search c:\windows s"
If that all is correct, then the command i gave you would work. Only thing that needs to be ensured is that the location of the path is where the cmd windows open or is available in the PATH