简体   繁体   中英

Running a batch file in powershell

I am using the application LabTech to write scripts for Leo backup. I have a batch file on my local C drive (backup.bat). I need that file to run when a backup fails. How would I do this in powershell with commands? I looked on Google and could not find anything concrete.

Any help is appreciated. Please let me know if you need any more information.

You can try replacing email line (or add under it)

& "path\to\your\file.bat"

if there are spaces. If not:

path\to\your\file.bat 

尝试使用-wait开关,这样您的Powershell脚本将暂停,直到backup.bat和隐藏的开关完成,从而使其看不见地运行。

Start-Process -FilePath 'C:\Backup.bat' -Wait -WindowStyle Hidden

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM