-1

Is there a way to run a batch file on my local as400 server from as400 command line as this batch file exists at a shared folder exists on my local as400 server.

batch file:

   cd  C:\D1
    for /R %%f in (*.xml) do (
         echo "%%f" 
         copy %%f  C:\backup
         move %%f  Z:\
          GOTO :Exit
    )
    
    :Exit
John Y
  • 14,123
  • 2
  • 48
  • 72
Esra
  • 1
  • 1
  • Need more detail on what you mean. Can you give an example of the 'batch file'? You might have to create a program to read the batch file and execute the commands. Or compile a temporary version and execute that. But it depends on what you are trying to do. – Scott Mildenberger May 19 '22 at 14:01
  • @ScottMildenberger i need to copy first remote xml file to a directory in the same remote server then move it to the shared folder. I updated the question with the batch file content. – Esra May 19 '22 at 16:11
  • This does not look like CL. What language is it? The as400 does not use the DOS batch commands, nor does it use powershell, though if you run it correctly, you could use one of the shells provided by PASE. That supports the Korn, Bourn, and C shells. – jmarkmurphy May 19 '22 at 19:12
  • Practically anyone who is writing scripts in a shell language for PASE are using Bash. I think the only other one with a statistically significant number of users would have to be Korn, since it's the default. – John Y May 20 '22 at 15:42
  • Incidentally, I've added back the [batch-file] tag because, while it won't actually run on the IBM midrange platform, it *is* what the OP is trying to do, as evidenced by the code sample provided. – John Y May 20 '22 at 15:49

1 Answers1

0

Running Batch files like .bat or .cmd ia nor possible on the IBMi. But, you can run then on the PC when the batchfile is available on the IFS (or a IBMi share). If you realy need to run it on the IBMi, then you need to use the QSHELL (QSH) environment (Qshell is a command environment based on POSIX and X/Open standards). So you can run linux commands on it. But if I look to your example script, IBMi doesn't have a C: not Z: disk.