· Apr 1, 2019

$ZF(-100) help.

Hello all!

My company has been switching from $zf(-1) to $zf(-100) like many companies have been. I have been doing fine with 1 argument windows commands such as:

set errorfile = "D:\folder\error.txt"
set outputfile = "D:\folder\output.txt"

set options(1) = ""
set options(2) = "D:\ThomasTools\"

w $zf(-100,"/SHELL /STDERR="_errorfile_" /STDOUT="_outputfile, "dir", .options)

same as w $zf(-1,"dir D:\ThomasTools\ >> D:\folder\output.txt")

I get a valid response and everything works correctly. I am having troubles with commands that would take multiple arguments however. 
valid reponse with w $zf(-1, "type D:\folder\file1.txt >> D:\folder\file2.txt")

set options(1) = ""
set options(2) = "D:\folder\file1.txt"
set options(3) = ">>"
set options(4) = "D:\folder\file2.txt"

w $zf(-100, "/SHELL /STDERR="_errorfile_"/STDOUT="_outputfile,"type",.options)

even tried with
set options(1) = ""
set options(2) = "D:\folder\file1.txt"
set outputfile = "D:\folder\file2.txt"
w $zf(-100,"/SHELL /STDERR="_errorfile_"/STDOUT+="_outputfile,"type",.options)

seemed logical but both are giving me errors. Anyone care to help me hammer this out?

Discussion (1)1
Log in or sign up to continue

The first $zf(-100) call doesn't work, because you're trying to redirect with the /STDOUT flag and the ">>" operator. You can do one or the other, but not both.

If you add the /LOGCMD flag to the second $zf(-100) call, you should see something like the following in messages.log:

    $ZF(-100) cmd=type "" file1.txt

I suggest that you not put an empty string in your options array.