Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 如何使用批处理脚本清除excel文件中的内容?_Batch File - Fatal编程技术网

Batch file 如何使用批处理脚本清除excel文件中的内容?

Batch file 如何使用批处理脚本清除excel文件中的内容?,batch-file,Batch File,如何使用批处理脚本清除excel文件中的内容 我试过这个,但没用 type nul > test.xlsx excel文件不是文本文件,即使是空文件也包含一些二进制元数据。 尝试以下操作(在第二行,您可以设置新文件的名称): 应将文件替换为零长度文件,从而有效地删除数据。检查以下文件夹(): C:\Users\All Users\Microsoft\Windows\Templates %APPDATA%\Microsoft\Windows\Templates %APPDATA%\Mi

如何使用批处理脚本清除excel文件中的内容

我试过这个,但没用

type nul > test.xlsx 

excel文件不是文本文件,即使是空文件也包含一些二进制元数据。 尝试以下操作(在第二行,您可以设置新文件的名称):

应将文件替换为零长度文件,从而有效地删除数据。

检查以下文件夹():

  • C:\Users\All Users\Microsoft\Windows\Templates
  • %APPDATA%\Microsoft\Windows\Templates
  • %APPDATA%\Microsoft\Excel\XLSTART
  • %useprofile%\Templates
可能有Excel模板,例如(否则为t)

  • Book.xlt
    .xltx
    /
    .xltm
    )或
  • Sheet.xlt
    .xltx
    /
    .xltm
让我们假设有这样一个文件
%useprofile%\Templates\Sheet.xltx

然后,下一个命令应执行以下操作:

copy /Y /B "%useprofile%\Templates\Sheet.xltx" test.xlsx

我在运行上述代码时遇到此错误。返回的解码文件数据无效。0x8007000d(WIN32:13)CertUtil:-解码命令失败:0x8007000d(WIN32:13)CertUtil:数据无效。按任意键继续@AVK-你确定你复制了全部内容吗script@AVK-您需要最后一行。否则,certutil将不知道何时读取该文件。我尝试了整个代码,但excel内容仍然没有清除。@AVK-您更改了excel文件的名称吗?目前它是
new.xslx
,应该清除\创建具有此名称的文件。
copy nul test.xlsx
copy /Y /B "%useprofile%\Templates\Sheet.xltx" test.xlsx