1.

Solve : batch script to search file better or close to window search?

Answer»

Try removing "@echo off" and opening it from command prompt and POSTING what it shows here.
(EASY way to do this is Rightclick->Mark->ArrowKeys+Shift->Enter)
K:\PC\powershell 2.0\bat.bat\buat BATCH>if not defined token (
echo Search for what string?
set /p token=>
echo.
)
Search for what string?
>masa


K:\PC\powershell 2.0\bat.bat\buat batch>set a=0

K:\PC\powershell 2.0\bat.bat\buat batch>for /F "delims=" %A in ('dir /b | find "
masa"') do (
set /a a+=1
echo !a!. %A
echo !a!. %A 1>>log
)

K:\PC\powershell 2.0\bat.bat\buat batch>(
set /a a+=1
echo !a!. masa 3 saat.txt
echo !a!. masa 3 saat.txt 1>>log
)
1. masa 3 saat.txt

K:\PC\powershell 2.0\bat.bat\buat batch>(
set /a a+=1
echo !a!. masa dlm saat.txt
echo !a!. masa dlm saat.txt 1>>log
)
2. masa dlm saat.txt

K:\PC\powershell 2.0\bat.bat\buat batch>echo.


K:\PC\powershell 2.0\bat.bat\buat batch>echo Enter number of file to open.
Enter number of file to open.

K:\PC\powershell 2.0\bat.bat\buat batch>set /p op=>
>1

K:\PC\powershell 2.0\bat.bat\buat batch>for /F "tokens=1,2,3 delims=." %A in (lo
g) do (if %A EQU 1 start %B )

K:\PC\powershell 2.0\bat.bat\buat batch>(if 1 EQU 1 start masa 3 saat )should be:
tokens=1,2
not
tokens=1,2,3

OR you can change "%%B to %%B.%%C"Quote from: Lemonilla on October 01, 2013, 05:17:56 AM

should be:
tokens=1,2
not
tokens=1,2,3

OR you can change "%%B to %%B.%%C"

thank you

i try tokens=1,2,3 because batch not read file TYPE example ".txt"

i forgot add %%C on %%B can solve the problem

now batch work perfectly...thank you x10000000000


Discussion

No Comment Found