a batch file to search for anything within windows for final extams

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
rahhem
Posts: 7
Joined: 04 Jan 2016 06:35

a batch file to search for anything within windows for final extams

#1 Post by rahhem » 04 Jan 2016 06:42

hello folks

i really need help with a batch file code to search for anything within windows like search in windows?
any ideas


please please please please please i really need this :?: :?: :?: :?: :?: :?: :?: :?: :| :| :| :|

something like the traditional windows 8/10 search box.

to be able to search for all pdf files and files with my name on .

i study in dutch so its not easy for me but if i can get the code i may able to translate them . thank you all
Last edited by rahhem on 04 Jan 2016 09:44, edited 1 time in total.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: a batch file to search for anything within windows for final extams

#2 Post by Squashman » 04 Jan 2016 07:56

What are you trying to search for?
A file?
Text within a text file?

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: a batch file to search for anything within windows for final extams

#3 Post by ShadowThief » 04 Jan 2016 08:20

What, like the find command or the dir command?

rahhem
Posts: 7
Joined: 04 Jan 2016 06:35

Re: a batch file to search for anything within windows for final extams

#4 Post by rahhem » 04 Jan 2016 09:26

some text files and other file on my harddrive, just like traditional windows search

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: a batch file to search for anything within windows for final extams

#5 Post by Squashman » 04 Jan 2016 11:44

DIR /S *.txt "Another file.doc"

rahhem
Posts: 7
Joined: 04 Jan 2016 06:35

Re: a batch file to search for anything within windows for final extams

#6 Post by rahhem » 04 Jan 2016 12:12

Now the question where and how do I place to text commands?
Or anywhere ?

rahhem
Posts: 7
Joined: 04 Jan 2016 06:35

Re: a batch file to search for anything within windows for final extams

#7 Post by rahhem » 04 Jan 2016 13:29

so far this how i get , guys don't mind the stupid foreign language

Code: Select all

echo off 
title zoekopalles
color 9f
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

:one
cls
echo Halo %username% mijn naam is Zoekopalles!
echo                 Welkome
echo Gelieve uw voornaam in te vullen:
echo.
echo.
set /p fnaam=
echo.
echo.
echo Hallo leuk om jou te ontmoeten %fnaam%!
pause>nul

:start
Title Het Menu
cls
echo                        %TIME% %DATE%D%M%J%
echo.
echo                 1- PDF Bestanden
echo                 2- Word Bestanden
echo                 3- Refreshen

set Choice=
set /p Choice=""
pause>nul

if '%Choice%'=='1' goto PDF Bestanden
if '%Choice%'=='2' goto Word Bestanden
if '%Choice%'=='3' goto Refreshen

cls
echo '%Choice%' is niet geldig
ping localhost -n 2 >Nul
echo Probeer Opniuew
ping localhost -n 2 >nul
cls
goto start




any subjections where i should place the directory code?

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: a batch file to search for anything within windows for final extams

#8 Post by Squashman » 04 Jan 2016 13:33

I think there is a couple of people that frequent this forum that speak your language. Hard to tell where you want to put it. I have no idea what you are trying to accomplish. You have GOTO statements in your code with NO labels to GOTO. Hard to give you any advice.

rahhem
Posts: 7
Joined: 04 Jan 2016 06:35

Re: a batch file to search for anything within windows for final extams

#9 Post by rahhem » 04 Jan 2016 16:20

please they code did not work , each time i run the batch file , it just gives the name of the c drive and volume and the serial number?

can any one help. just a directories name to search for pdf and word file please help me folk this is my last the make something good in for me please

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: a batch file to search for anything within windows for final extams

#10 Post by penpen » 04 Jan 2016 18:11

I'm not sure, maybe this is a first step (if i don't misinterpret what you want to do):

Code: Select all

@echo off 
title zoekopalles
color 9f

:one
cls
echo Hello %username% my name is Zoekopalles ^(?FindAll?^)!
echo Welcome
echo Please enter your first name:
echo.
echo.
set /p "firstName="
echo.
echo.
echo Hi nice to meet you %firstName%!
pause

:start
Title The menu
cls
echo %TIME% %DATE%
echo.
echo 1- PDF files
echo 2- Word files
echo 3- Refresh

set "choice="
set /p "choice="

if "%choice%" == "1" goto :pdfFiles
if "%choice%" == "2" goto :wordFiles
if "%choice%" == "3" goto :refresh

cls
echo "%choice%" is not valid
>nul ping localhost -n 2
echo Try again.
>nul ping localhost -n 2
cls
goto :start


:pdfFiles
rem search C:\ and all subdirectories for Word files
pushd "C:\"
echo DIR "C:\" /S "*.pdf"
popd
pause
goto :eof

:wordFiles
rem search C:\ and all subdirectories for Word files
pushd "C:\"
echo DIR "C:\" /S "*.doc" "*.docm" "*.docx" "*.replaceWithOtherWordFileExtensions"
popd
pause
goto :eof

:refresh
echo don't know what to do here
pause
goto :eof


penpen

rahhem
Posts: 7
Joined: 04 Jan 2016 06:35

Re: a batch file to search for anything within windows for final extams

#11 Post by rahhem » 05 Jan 2016 14:37

thanks man

Post Reply