【发布时间】:2010-11-09 03:29:50
【问题描述】:
好的。 我想停止正在运行的进程,然后在进程停止后继续执行脚本。
例如:停止媒体播放器,然后删除媒体播放器数据库(如果你有 wmp12 你可能明白原因!) 但脚本的其余部分会在应用程序有时间关闭之前开始执行。
#stop wmp
stop-process -processname wmplayer
#delete
dir "C:\Users\blergh\AppData\Local\Microsoft\Media Player" -filter *wmdb | foreach { del $_.fullname}
我得到:
Remove-Item : Cannot remove item C:\Users\blergh\AppData\Local\Microsoft\Media Player\CurrentDatabase_372.wmdb: The proces
s cannot access the file 'C:\Users\blergh\AppData\Local\Microsoft\Media Player\CurrentDatabase_372.wmdb' because it is bei
ng used by another process.
我可以强制它同步运行吗?
谢谢, P
【问题讨论】:
标签: powershell