为什么在以64位TextPad作为外部工具运行的.BAT文件中,FIND失败,该如何解决?
当我运行此.BAT文件
//Query for the GUID of the Account using Account Name
QueryExpression query = new QueryExpression("account");
string[] cols = { "accountid", "name" };
query.Criteria = new FilterExpression();
query.Criteria.AddCondition("name", ConditionOperator.Equal, "Account Name");
query.ColumnSet = new ColumnSet(cols);
var account = Service.RetrieveMultiple(query);
//Casting the reference to GUID
Guid accountId = (Guid)account[0].Attributes["accountid"];
在CMD,FIND输出匹配项
但是当我在64位TextPad中将其作为外部工具运行时,FIND无法输出匹配项,并且TextPad报告返回码1(“找不到字符串”)
编辑:工作环境:
Word.Application wordapplication = new Word.Application
{
Visible = false
};
Word.Document wordDocument = wordapplication.Documents.Add(filePathWithName);
wordapplication.ActivePrinter = printer;
Range range = wordapplication.ActiveDocument.Range(
wordapplication.ActiveDocument.Content.Start,
wordapplication.ActiveDocument.Content.End);
//wordapplication.ActiveDocument.Fields.Add(range, WdFieldType.wdFieldPrint, "&l0S", false); //This also didn't work, people says it works for PCL5 only
wordapplication.ActiveDocument.PrintOut(); ///ManualDuplexPrint: false also didn't work
wordDocument.Close(SaveChanges: false);
wordDocument = null;
// Make sure all of the documents are gone from the queue
while (wordapplication.BackgroundPrintingStatus > 0)
{
System.Threading.Thread.Sleep(250);
}
wordapplication.Quit(SaveChanges: false);
wordapplication = null;