-1

I try to run this simple script on Windows Serwer 2012, which works fine on Windows 7. For loop doesn't work, because parameter(%%A line of txt file) is not recognized in the statment. How I Can do this loop to works on Windows Server 2012?

        @Echo off 

mkdir E:\datastage_backup\%date:~-4,4%%date:~-10,2%%date:~7,2%

REM ***Nazwa serwera***
SET H = INFOSRV
REM ***Ip:Port***
SET D = 111.11.11.11:1111
REM ***Nazwa katalogu z exportem***
SET EXPORT_CMD = C:\Users\alato.EXORIGO\Desktop\export\

C:\IBM\InformationServer\Clients\Classic\dsjob -server SMYK-INFOSRV -user alato -password password -domain 111.11.11.11:1111 -lprojects > %EXPORT_CMD%list.txt

@echo on

for /F %%A in (list.txt) do (
    C:\IBM\InformationServer\Clients\Classic\dscmdexport %D% %H% /U=alato /P=password %%A C:\Users\alato.EXORIGO\Desktop\export\%DATE%\%%A.dsx
)
peterh
  • 11,875
  • 18
  • 85
  • 108

2 Answers2

0

For first iteration I get something like this

C:\IBM\InformationServer\Clients\Classic\dscmdexport   /U=alato /P=rt9jTT123 %A C:\Users\alato.EXORIG
O\Desktop\export\Fri 03/11/2016\%A.dsx

They schould be like this:

    C:\IBM\InformationServer\Clients\Classic\dscmdexport   /U=alato /P=rt9jTT123 VALUE_OF_VARIABLE C:\Users\alato.EXORIGO\Desktop\export\Fri 03/11/2016\VALUE_OF_VARIABLE.dsx
0

Don't use spaces in SET commands unless you really want them. You should also use quotes to ensure that there are no trailing spaces. Change these lines.

SET "H=INFOSRV"

SET "D=111.11.11.11:1111"

SET "EXPORT_CMD=C:\Users\alato.EXORIGO\Desktop\export\"
RGuggisberg
  • 4,630
  • 2
  • 18
  • 27