Help needed with string manipulation - PAOLO - Italy
Posted: 17 Sep 2007 02:49
Parameter %1 is provided by doubleclicking on a file name in the directory C:\ESITOCHK an can be in the form:
"C:\ESITOCHK\xxxxxxxx.Nyy.PDF.P7M" or
"C:\ESITOCHK\xxxxxxxx.Xyy.P7M
I must create an output file (by program sbusta.bat) with the same name but without the P7M extension and:
if the first extension starts witx "N" i must create the corresponding xxxxxxxx.Nyy.PDF file
if the first extension starts witx "X" i must create the corresponding xxxxxxxx.Xyy file
This program works only if the parameter 1% is in the form "C:\ESITOCHK\xxxxxxxx.Nyy.PDF.P7M" and then
the variable "stringa" is "N";
The sbusta.bat wants two parameters: 1-input file path; 2-output file path
If "stringa" is "X", it seems that the sbusta.bat is not called since the output file is not in the output file path.
Can anyone explain to me why ? Please help me and thanks a lot in advance.
Paolo
@echo off
cls
set X=X
set N=N
set nomefile=%1
set fileinput=%nomefile%
set stringa=%nomefile%
set stringa=%stringa:~22,1%
set outpdf=%nomefile%
set outstd=%nomefile%
echo %fileinput%
set fileinput=%fileinput:~13,20%
set outpdf=%outpdf:~13,16%
set outstd=%outstd:~13,12%
echo fileinut %fileinput%
echo outpdf %outpdf%
echo outstd %outstd%
echo stringa %stringa%
pause
if %stringa% == X set outfile=%outstd%
if %stringa% == N set outfile=%outpdf%
echo outfile %outfile%
pause
call sbusta.bat %fileinput% c:\firmav~1\verifi~1\%outfile%
echo. End Program
pause
"C:\ESITOCHK\xxxxxxxx.Nyy.PDF.P7M" or
"C:\ESITOCHK\xxxxxxxx.Xyy.P7M
I must create an output file (by program sbusta.bat) with the same name but without the P7M extension and:
if the first extension starts witx "N" i must create the corresponding xxxxxxxx.Nyy.PDF file
if the first extension starts witx "X" i must create the corresponding xxxxxxxx.Xyy file
This program works only if the parameter 1% is in the form "C:\ESITOCHK\xxxxxxxx.Nyy.PDF.P7M" and then
the variable "stringa" is "N";
The sbusta.bat wants two parameters: 1-input file path; 2-output file path
If "stringa" is "X", it seems that the sbusta.bat is not called since the output file is not in the output file path.
Can anyone explain to me why ? Please help me and thanks a lot in advance.
Paolo
@echo off
cls
set X=X
set N=N
set nomefile=%1
set fileinput=%nomefile%
set stringa=%nomefile%
set stringa=%stringa:~22,1%
set outpdf=%nomefile%
set outstd=%nomefile%
echo %fileinput%
set fileinput=%fileinput:~13,20%
set outpdf=%outpdf:~13,16%
set outstd=%outstd:~13,12%
echo fileinut %fileinput%
echo outpdf %outpdf%
echo outstd %outstd%
echo stringa %stringa%
pause
if %stringa% == X set outfile=%outstd%
if %stringa% == N set outfile=%outpdf%
echo outfile %outfile%
pause
call sbusta.bat %fileinput% c:\firmav~1\verifi~1\%outfile%
echo. End Program
pause