-
Notifications
You must be signed in to change notification settings - Fork 1
/
copyToMT5.ps1
35 lines (33 loc) · 1.09 KB
/
copyToMT5.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$MT5Hash = "24F345EB9F291441AFE537834F9D8A19" # magic!
$MT5TerminalPath = "$Env:APPDATA\MetaQuotes\Terminal\$MT5Hash\MQL5"
if (!(Test-Path($MT5TerminalPath))) {
Write-Error "MT5 terminal path not found: $MT5TerminalPath"
exit
}
$deployRules = @(
# deploy dependencies for live data
[PSCustomObject]@{
SourcePath = "$PSScriptRoot\Include"
DestinationPath = "$MT5TerminalPath\Include\nng"
},
[PSCustomObject]@{
SourcePath = "$PSScriptRoot\Libraries"
DestinationPath = "$MT5TerminalPath\Libraries"
},
# deploy scripts
[PSCustomObject]@{
SourcePath = "$PSScriptRoot\Scripts"
DestinationPath = "$MT5TerminalPath\Scripts\nng"
}
);
$deployRules | ForEach-Object {
$rule = $_
Get-ChildItem -Path $_.SourcePath | Foreach-Object {
$path = "$($rule.DestinationPath)\$($_.Name)"
$target = "$($rule.SourcePath)\$($_.Name)"
if (Test-Path $path) {
$(Get-Item $path).Delete()
}
New-Item -ItemType SymbolicLink -Path $path -Target $target -Force
}
}