I can't reproduce. From .bat and cmd the program with Spire code works well.
.bat:
.bat:
// script "Script89"
/*/ console true; role exeProgram; outputPath %folders.Workspace%\exe\Script89; r C:\Test\nuget\spire\Spire.Doc.dll; r C:\Test\nuget\spire\Spire.Pdf.dll; /*/
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
if (true) {
args = new[] {
@"queries\Spire\SP_多个位置加水印.linq", //代码路径
@"C:\Test", //args[1] 当前路径
@"日期域.docx", //args[2] 输出文件
};
}
Environment.CurrentDirectory = args[1];
Document document = new Document();
Section section = document.AddSection();
Paragraph paragraph = section.AddParagraph();
paragraph.AppendText("今天的日期为: ");
Field field = paragraph.AppendField("Date", FieldType.FieldData) as Field;
field.Code = @"DATE \@" + "\"yyyy年MM月dd日 \"";
document.SaveToFile(args[2], FileFormat.Docx2013);
print.it("ok");