styk.tv

Cloud Developer's Technology Encounters

Bat Command from Powershell

by polfilm on September 8, 2014

This way you don’t have to worry about escaping anything.

$command = @'
cmd.exe /C c:\windows\system32\ntbackup.exe backup "C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\chameme.bks" /n "1file.bkf1 created 06/09/2013 at 09:36" /d "Set created 06/09/2013 at 09:36" /v:no /r:no /rs:no /hc:off /m normal /j chameme /l:s /f "\\fs1\Exchange Backups$\1file.bkf"
'@

Invoke-Expression -Command:$command

Leave a Reply