Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

bat file execution

dear all,

I'm trying to execute without success, the script below. The gol is to remove all the files older than a certain number of days

BatFile:

Load

   'forfiles /p $(vselectedpath) /s /m *.$(vselectedtype) /d -$(vdaynumber) /c ' & ' "cmd /c del /q @path" ' As [@echo off]

AutoGenerate(1);

Store BatFile into c:\mydir\RmvOldFile.bat (txt);

Drop Table BatFile;

EXECUTE c:\mydir\RmvOldFiles.bat;

I always receive the message below. Help please

Thanks in advance

1 Solution

Accepted Solutions
cesaraccardi
Specialist
Specialist

Hi

Try this way:

EXECUTE cmd /c c:\mydir\RmvOldFiles.bat;

Kind Regards,

Cesar


View solution in original post

4 Replies
cesaraccardi
Specialist
Specialist

Hi

Try this way:

EXECUTE cmd /c c:\mydir\RmvOldFiles.bat;

Kind Regards,

Cesar


alexandros17
Partner - Champion III
Partner - Champion III

I think that the bat file has not been created ...

Anonymous
Not applicable
Author

Hi Cesar, really thanks.

But I need a little more help. Now the problem seems to be how the command is written. I store in this way

Load

  'forfiles /p $(vpath) /s /m *.$(vtype) /d -$(vdaynum) /c "cmd /c del /q @path" ' As [@echo off]

....

But editing by Notepad,  the created file is different and it doesn't work

"forfiles /p c:\bi_qlik\old_qdoc2 /s /m *.* /d -365 /c ""cmd /c del /q @path"" "

What I'm doing wrong ? I think the problem are the quotation mark, but I'm not able to solve it

Hope you can or somebody else can help me.

Thanks !

Anonymous
Not applicable
Author

Hi Alessandro,

the script has created the bat file but it doesn't work (see my previous reply)

I think the problem are the quotation mark, but I'm really confused.

Hope you can help me

Thanks in advance