我的代码需要一些帮助。 我目前在Citrix环境中工作,并且在第4行碰壁。 我已经尝试过创建一个没有命名为desktopicons的变量。
当我运行前三行时,似乎所有代码在第四行之前都运行良好。
PS脚本的主要思想是创建一个新文件夹,将所有桌面图标移至该新创建的文件夹。
[HttpPost]
public async Task<FileContentResult> Create([Bind("Id,StartDate,EndDate")] GetReport getReport)
{
DateTime startDate = getReport.StartDate;
DateTime endDate = getReport.EndDate;
// call the stored procedure and store dataset in a List.
List<User> users = _context.Reports.FromSql("exec dbo.SP_GetEmpReport @start={0}, @end={1}", startDate, endDate).ToList();
//set custome column names
string[] columns = { "Name", "Address", "ZIP", "Gender"};
byte[] filecontent = ExcelExportHelper.ExportExcel(users, "Users", true, columns);
// set file name.
return File(filecontent, ExcelExportHelper.ExcelContentType, "Report.xlsx");
}
答案 0 :(得分:0)
我认为您将事情与批处理文件混在一起。这是我的方法:
filepath=AppDomain.CurrentDomain.BaseDirectory + "\\data\\logs";
我添加了参数#get desktop path for current user
$DesktopPath = $ENV:HOMEDRIVE+$ENV:HOMEPATH+"\Desktop"
#create "newfolder" on users desktop
New-Item -Path $DesktopPath -Name 'newfolder' -Type Directory
#move all files from desktop into "newfolder" excluding "newfolder"
Move-Item -Path $DesktopPath"\*" -Destination $DesktopPath"\newfolder" -exclude 'newfolder' -WhatIf
来查看行实际执行的操作(而不是仅仅执行此操作)。如果您得到的输出可以接受,则只需删除此参数即可执行任务。