我编写了这个脚本来组合更多的 html 文件。我使用了随机函数作为其中的一部分。我看到一个奇怪的东西...
@echo on
pause
CD "C:\Documents and Settings\Mauro\Documenti\Firme\ProvaMerge\"
pause
for %%i in (Pasqualino,Mauro) DO (
pause
ECHO %%i
pause
type Parti_Standard\StrutturaTabella_1parte.txt > %%i.html
pause
type utenti\%%i.html >> %%i.html
pause
type Parti_Standard\StrutturaTabella_2parte.txt >>%%i.html
:loop
set /a photo=%random% %% 3 + 1
ECHO RANDOM
ECHO %random% %%PHOTO
TYPE Immagini\%photo%.txt >> %%i.html
pause
type Parti_Standard\StrutturaTabella_3parte.txt >> %%i.html
type Firme_Standard\"Firma Inox Pack.html" >> %%i.html
)
pause
一切正常,但我没有看到%photo%
变量...我尝试使用%%photo
or%photo%
但我只获得了一个空变量。相反,首先为了提高该脚本的复杂性,我在没有 for 循环的情况下使用它......而且它工作正常。
@echo on
CD "C:\Documents and Settings\Mauro\Documenti\Firme\ProvaMerge\"
type Parti_Standard\StrutturaTabella_1parte.txt >new.html
type mauro.html >> new.html
type Parti_Standard\StrutturaTabella_2parte.txt >>new.html
:loop
set /a photo=%random% %% 3 + 1
echo %%photo
pause
TYPE Immagini\%photo%.txt >> new.html
type Parti_Standard\StrutturaTabella_3parte.txt >> new.html
type Firme_Standard\"Firma Inox Pack.html" >>new.html
pause
为什么?