You are not logged in.

#1 24 Apr 2014 13:38

Graxor
New Member
Registered: 24 Apr 2014
Posts: 3

Problem using function "more" on windows server 2008 R2

Hello guys,

I have issue using the following code line :

for /f "delims=" %%a in ('MORE /E +%ligneNo2% ^< %File_Repository%') do (
  if not defined ligne2 set "ligne2=%%a"
)

The error i'm facing is :
'more' is not recognized as an internal or external command, operable program or batch file.

This error don't appear when I'm using windows 7 professional.

Did someone already faced this kind of error ?

Regards,
Yannick

Offline

#2 24 Apr 2014 13:39

foxidrive
Member
Registered: 04 Apr 2013
Posts: 339

Re: Problem using function "more" on windows server 2008 R2

To test this issue, open a cmd window and type

more /?

See what happens.

Offline

#3 24 Apr 2014 15:36

Honguito98
Member
From: Mexico
Registered: 19 Sep 2013
Posts: 57

Re: Problem using function "more" on windows server 2008 R2

Try type in a cmd window:

find /?

If you get an error, may be PATH variable is not set'ed the path to system32 folder, then check with this

path

.::{Honguito98}::.

Offline

#4 24 Apr 2014 15:53

Graxor
New Member
Registered: 24 Apr 2014
Posts: 3

Re: Problem using function "more" on windows server 2008 R2

Hello,

I tried both find /? and more /? and both are giving me information.

My path is the following :
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\sapjvm\bin

I'm using my script from the E:\. Do you think the issue could come from this ?

Regards,
Yannick

Offline

#5 24 Apr 2014 15:58

foxidrive
Member
Registered: 04 Apr 2013
Posts: 339

Re: Problem using function "more" on windows server 2008 R2

Are you using the variable name path in your batch file?  It sounds very much like it.

Offline

#6 24 Apr 2014 16:21

Graxor
New Member
Registered: 24 Apr 2014
Posts: 3

Re: Problem using function "more" on windows server 2008 R2

You can find the all code here.


@echo off

Echo Start send Mail

set File_Repository=%1

set count=0

rem -- Valeur rechercher dans le script
set value1="CUSTOMER_Catalog_PRD [V0-PMADB\PMA] (SQL_SVR)   2005    Loaded Running"
set value2="VENDOR_Catalog_PRD   [V0-PMADB\PMA] (SQL_SVR)   2000    Loaded Running"

Rem -- Ligne pour chaque valeur
set ligneNo1=4
set ligneNo2=5

set "ligne1="
set/a ligneNo1-=1
for /f "delims=" %%a in ('more/e +%ligneNo1% ^< %File_Repository%') do (
  if not defined ligne1 set "ligne1=%%a"
)
set ligne1bis="%ligne1%"

set "ligne2="
set/a ligneNo2-=1
for /f "delims=" %%a in ('more/e +%ligneNo2% ^< %File_Repository%') do (
  if not defined ligne2 set "ligne2=%%a"
)
set ligne2bis="%ligne2%"

if %ligne1bis% == %value1% set /a count+=1
if %ligne2bis% == %value2% set /a count+=1

set BLAT=E:\usr\sap\PMA\Scripts\Outils\
set SENDER=PRD_MDM_Status
set SERVEUR_SMTP=rel
set DEST=yannick.jacq@veolia.com

if not %count% == 2 %BLAT%\blat.exe %File_Repository% -f %SENDER% -server %SERVEUR_SMTP% -to %DEST%

Echo End send mail

pause

Offline

#7 24 Apr 2014 17:28

foxidrive
Member
Registered: 04 Apr 2013
Posts: 339

Re: Problem using function "more" on windows server 2008 R2

Test this code:

@echo off
set File_Repository=file.txt
(
echo 1
echo 2
echo 3
echo 4
)>%File_Repository%

set ligneNo2=2
set "ligne2="
for /f "delims=" %%a in ('more/e +%ligneNo2% ^< %File_Repository%') do (
  if not defined ligne2 set "ligne2=%%a"
)
echo "%ligne2%"
pause

Offline

Board footer

Powered by