1.

Solve : fc not recognized as an internal or external command.?

Answer»

So fc is actually a command, but it doesn't seem to work when I run the batch FILE. Any ideas?

code:
Code: [Select]::@echo off
setlocal EnableDelayedExpansion

::ADD MODIFYERS AND HELP MENU LATER


::Get file pathway
set path=%~pdnx1


::Find Matches
for /r %cd:~0,1%: %%A in (*.*) do (
fc /b /LB0 "%path%" "%%A" >nul
if !errorlevel! == 0 call :match %%A
)

EXIT /b

:match
echo Match found at %1.
goto :eof

output/proof
Code: [Select]
T:\>(
fc /b /LB0 "T:\essay5.bat" "T:\In The Works\_graph.bat"
if !errorlevel! == 0 call :match T:\In The Works\_graph.bat
)
'fc' is not recognized as an internal or external command,
operable PROGRAM or batch file.

T:\>(
fc /b /LB0 "T:\essay5.bat" "T:\test\essay5.bat"
if !errorlevel! == 0 call :match T:\test\essay5.bat
)
'fc' is not recognized as an internal or external command,
operable program or batch file.

T:\>exit /b

T:\>fc /?
Compares two files or sets of files and displays the differences between
them


FC [/A] [/C] [/L] [/LBn] [/N] [/OFF[LINE]] [/T] [/U] [/W] [/nnnn]
[drive1:][path1]filename1 [drive2:][path2]filename2
FC /B [drive1:][path1]filename1 [drive2:][path2]filename2

/A Displays only first and LAST lines for each set of differences.
/B Performs a binary comparison.
/C Disregards the case of letters.
/L Compares files as ASCII text.
/LBn Sets the maximum consecutive mismatches to the specified
number of lines.
/N Displays the line numbers on an ASCII comparison.
/OFF[LINE] Do not skip files with offline attribute set.
/T Does not expand tabs to spaces.
/U Compare files as UNICODE text files.
/W Compresses white space (tabs and spaces) for comparison.
/nnnn Specifies the number of consecutive lines that must match
after a mismatch.
[drive1:][path1]filename1
Specifies the first file or set of files to compare.
[drive2:][path2]filename2
Specifies the second file or set of files to compare.


T:\>fc /b /LB0 "T:\essay5.bat" "T:\test\essay5.bat"
Comparing files T:\essay5.bat and T:\TEST\ESSAY5.BAT
FC: no differences encountered


T:\>

EDIT:
more testing:
Code: [Select]T:\>for /f "delims=" %A in ('dir /b /a:-d') do fc /b /LB0 "%A" "essay5.bat" >nul
&& echo %errorlevel%

T:\>fc /b /LB0 "essay5.bat" "essay5.bat" 1>nul && echo 1
1

T:\>fc /b /LB0 "fndmtch.bat" "essay5.bat" 1>nul && echo 1

T:\>
You change the path environment variable by re-using it for a temporary variable.What do you want to do?
http://msdn.microsoft.com/en-us/library/bb385990%28v=vs.90%29.aspx/html
Compare Two FilesWow... Can't believe I made that mistake... Thanks for pointing it out BC_Programmer!



Discussion

No Comment Found