使用Batch打开文件并删除文件夹

时间:2017-08-24 07:19:44

标签: batch-file cmd

我想打开docx (Rough.docx和Ticker.docx)并删除/复制某个文件夹,但先批量打开文件(粗略)并停止/等待。以下是批次代码。

"C:\Documents and Settings\Administrator\Desktop\Rough.docx"
"C:\Documents and Settings\Administrator\Desktop\Ticker.docx"

del "C:\Documents and Settings\Administrator\Desktop\download\*.*" /q
rd /s /q "C:\Documents and Settings\Administrator\Desktop\EMEA CEEMEA"
xcopy "D:\W" "C:\Documents and Settings\Administrator\Desktop\" /E

我应该包括什么来默默地做这一切。我的意思是不要显示CMD。在VBA中像Application.ScreenUpdating = False 我是批量编程的新手

1 个答案:

答案 0 :(得分:1)

使用start命令。
假设您要使用MS Word打开文件。

start winword.exe "C:\Documents and Settings\Administrator\Desktop\Rough.docx"
start winword.exe "C:\Documents and Settings\Administrator\Desktop\Ticker.docx"

rd /s /q "C:\Documents and Settings\Administrator\Desktop\EMEA CEEMEA"
xcopy "D:\W" "C:\Documents and Settings\Administrator\Desktop\" /E

如果您不希望在作为计划任务启动时打开CMD,则需要调用cmd.exe:

%windir%\system32\cmd.exe /c PathToYourBATFile

如果您想通过点击手动启动批处理,请创建一个快捷方式,然后在属性中选择Minimized