I am trying to put together a Batch Script to run ALL of the files one after the other in SILENT mode within the Implement Folder.
I have created a Batch Script for each . . .
Code: Select all
@echo off
Set Folder=C:\Implement
For %%i In (%Folder%\*.reg) Do (regedit /s %%i)
echo.
echo REG Implementation Completed Successfully!
Pause
EXIT
Code: Select all
@echo off
Set Folder=C:\Implement
Set PowerShellExe=%windir%\System32\WindowsPowerShell\v1.0\powershell.exe
For %%i In (%Folder%\*.ps1) Do (%PowerShellExe% -NoProfile -ExecutionPolicy Bypass -Command %cd%\%%i)
echo.
echo PS Implementation Completed Successfully!
Pause
EXIT
Code: Select all
@echo off
Set Folder=C:\Implement
Set cmdExe=%windir%\System32\cmd.exe
For %%i In (%Folder%\*.bat) Do (%cmdExe% \%%i)
echo.
echo CMD Implementation Completed Successfully!
Pause
EXIT
EDIT:
I found this bit of PowerShell code . . .
Code: Select all
Get-ChildItem '.\*.reg' | ForEach{
$Result = Start-Process Reg -ArgumentList Import, $_ -Wait -PassThru
echo ( '{0} - {1}' -f $Result.ExitCode, $_.Name)
}
Thanks in advance.