Batch file to update Portfolio Slicer external data files
Overview
Portfolio Slicer comes with a set of batch files (.bat) in the root of the PSDataExtract folder. These batch files execute PowerShell scripts in a predefined order.
deduplicate.bat- checks all quote files in theQuotessubfolder for duplicate records and removes them.UpdatePSData.bat- runs PowerShell scripts to update all files for Portfolio Slicer reports.UpdatePSDataIntraday.bat- runs a slightly different set of PowerShell scripts to extract intraday data.UpdatePSDataFromExcel.bat- runs PowerShell scripts that only extract data from the PortfolioSlicer-Source.xlsx file.
As a general rule, users will run or schedule these batch files (.bat) instead of executing PowerShell scripts directly.
Note: if a line in the file starts with REM, that means the line is a comment and is not executed.
Batch file deduplicate.bat
You would execute this batch file if UpdatePSData scripts reported duplicate quotes. This batch file removes all duplicate records from files in the Quotes subfolder.
After executing this batch file, you will need to run UpdatePSData.bat to re-create the files for Portfolio Slicer reports.
Batch file UpdatePSData.bat
This batch file runs PowerShell scripts to update all files for Portfolio Slicer reports.

The very last script executed by this batch file is psCheckFiles.ps1, which checks all files for basic data and formatting issues.
You would run this batch file if you want to extract data once or twice a day and get the latest data from the Excel source file and from web data sources.
If you see any issues with your reports, you should run this batch file and then refresh the reports.
Batch file UpdatePSDataIntraday.bat
This batch file runs a slightly different set of PowerShell scripts to extract intraday data.

Because it executes a smaller set of scripts, this batch file runs much faster than the full extract.
You would run this batch file if you want to check how your portfolio is doing multiple times per day.
Batch file UpdatePSDataFromExcel.bat
This batch file runs PowerShell scripts that only extract data from the PortfolioSlicer-Source.xlsx file.

You would run this batch file after you update your Excel source file and want to see those updates reflected in Portfolio Slicer report files.
Scheduling Updates
If you use Portfolio Slicer regularly, you may want to schedule these batch file executions with Windows Task Scheduler.
Typical examples include:
- a regular evening and early morning run for full updates with the
UpdatePSData.batbatch file. - optional intraday runs during market hours if that fits your workflow, using the
UpdatePSDataIntraday.batbatch file.
If you schedule updates, make sure the scripts run in a stable environment with access to the expected folders and files.
Practical Advice
- start by running the batch manually until you trust the configuration
- test with a small symbol set before scaling up
- review script output before assuming the generated files are correct
- use validation scripts if results look suspicious
- if the batch appears to succeed but Excel results look wrong, inspect the generated files directly