Metatrader and powershell

1
Hello friends,

For people are testing between strategies and need to clear specific or all folders on MQL4, i understand there are different ways to coded, but if have any sugestion or different way, lets to this.

This is powershell, if you want use them, save all above code with ps1 extension

Code: Select all

###############################################
# Install modules if necessary for make this menu possible to run
# Source at: https://github.com/dan-osull/PowerShell-Script-Menu-Gui
Write-Host "Install modules if necessary for make this menu possible to run"
Install-Module PSScriptMenuGui -Scope CurrentUser -Force

###############################################
# Hide or Minimize the powershell prompt after Winform Launch
# Source at: https://stackoverflow.com/questions/15922745/hide-or-minimize-the-powershell-prompt-after-winform-launch
Write-Host "Hide or Minimize the powershell prompt after Winform Launch"
$host.ui.RawUI.WindowTitle = "Hide or Minimize the powershell prompt after Winform Launch"
$t = '[DllImport("user32.dll")] public static extern bool ShowWindow(int handle, int state);'
add-type -name win -member $t -namespace native
[native.win]::ShowWindow(([System.Diagnostics.Process]::GetCurrentProcess() | Get-Process).MainWindowHandle, 0)

###############################################
# Enable silent mode on output only this script
Write-Host "Enable silent mode on output only this script"
$host.ui.RawUI.WindowTitle = "Enable silent mode on output only this script"
$ErrorActionPreference = 'SilentlyContinue'

###############################################
# Hide the Windows Terminal console window with PowerShell
# Source at: https://stackoverflow.com/questions/74968665/hide-the-windows-terminal-console-window-with-powershell
Write-Host "Hide the Windows Terminal console window with PowerShell"
$host.ui.RawUI.WindowTitle = "Hide the Windows Terminal console window with PowerShell"

Add-Type @"
  using System;
  using System.Runtime.InteropServices;
  public class UserWindows {
    [DllImport("user32.dll")]
    public static extern IntPtr GetWindowText(IntPtr hWnd, System.Text.StringBuilder text, int count);
}
"@

$stringbuilder = New-Object System.Text.StringBuilder 256

$windowcode = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);'
$asyncwindow = Add-Type -MemberDefinition $windowcode -name Win32ShowWindowAsync -namespace Win32Functions -PassThru
$hwnd = (Get-Process -PID $pid).MainWindowHandle
$count = [UserWindows]::GetWindowText($hwnd, $stringbuilder, 256)
"The name of this window is: $($stringbuilder.ToString())"
if ($hwnd -ne [System.IntPtr]::Zero) {
  $hidden = $asyncwindow::ShowWindowAsync($hwnd, 0)
}

$run = $true
$x=1
while ($x -le 1) {
  [console]::beep(500,100)
  Start-Sleep 1
  $x++
  }

###############################################
# Build requirements to run this script
Write-Host "Build requirements to run this script"
$host.ui.RawUI.WindowTitle = "Build requirements to run this script"
Write-Host "Resume what is does this specific task"
Write-Host "        Step 1: Build requirements to run this script -> Remove on previous files used"
Write-Host "        Step 2: Build requirements to run this script -> Build folder structure necessary"
Write-Host "        Step 3: Build requirements to run this script -> Declare windows variable"
Write-Host "        Step 4: Build requirements to run this script -> Create file for using on this menu"
Write-Host "        Step 5: Build requirements to run this script -> Create csv file for using on build menu"
Write-Host "        Step 6: Build requirements to run this script -> Create empty necessary additional files in batch to make all menu operational"
Write-Host "            Step 6.1: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on logs folder, delete older than 14 days"
Write-Host "            Step 6.2: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Common folder, delete content"
Write-Host "            Step 6.3: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Experts folder, delete content"
Write-Host "            Step 6.4: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Images folder, delete content"
Write-Host "            Step 6.5: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Files folder, delete content"
Write-Host "            Step 6.6: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Include folder, delete content"
Write-Host "            Step 6.7: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Indicators folder, delete content"
Write-Host "            Step 6.8: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Libraries folder, delete content"
Write-Host "            Step 6.9: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Logs folder, delete content"
Write-Host "            Step 6.10: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Presets folder, delete content"
Write-Host "            Step 6.12: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Scripts folder, delete content"
Write-Host "            Step 6.13: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Sounds folder, delete content"
Write-Host "            Step 6.14: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on history\mailbox folder, delete content"
Write-Host "            Step 6.15: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on history\deleted folder, delete content"
Write-Host "            Step 6.16: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\caches folder, delete content"
Write-Host "            Step 6.17: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\files folder, delete content"
Write-Host "            Step 6.18: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\history folder, delete content"
Write-Host "            Step 6.19: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\logs folder, delete content"
Write-Host "            Step 6.20: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on profiles\default folder, delete content"
Write-Host "            Step 6.21: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Open all MetaTrader 4"
Write-Host "            Step 6.22: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Run all previous step in OneClick"
Write-Host "            Step 6.23: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Close this script"
Write-Host "        Step 7: Build requirements to run this script -> Create empty necessary additional files in powershell to make all menu operational"
Write-Host "            Step 7.1: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on logs folder, delete older than 14 days and create new folder is necessary"
Write-Host "            Step 7.2: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on MQL4\Common folder, delete content and create new folder is necessary"
Write-Host "            Step 7.3: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on MQL4\Experts folder, delete content and create new folder is necessary"
Write-Host "            Step 7.4: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on MQL4\Images folder, delete content and create new folder is necessary"
Write-Host "            Step 7.5: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on MQL4\Files folder, delete content and create new folder is necessary"
Write-Host "            Step 7.6: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on MQL4\Include folder, delete content and create new folder is necessary"
Write-Host "            Step 7.7: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on MQL4\Indicators folder, delete content and create new folder is necessary"
Write-Host "            Step 7.8: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on MQL4\Libraries folder, delete content and create new folder is necessary"
Write-Host "            Step 7.9: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on MQL4\Logs folder, delete content and create new folder is necessary"
Write-Host "            Step 7.10: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on MQL4\Presets folder, delete content and create new folder is necessary"
Write-Host "            Step 7.11: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on MQL4\Scripts folder, delete content and create new folder is necessary"
Write-Host "            Step 7.12: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on MQL4\Sounds folder, delete content and create new folder is necessary"
Write-Host "            Step 7.13: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on history\mailbox folder, delete content and create new folder is necessary"
Write-Host "            Step 7.14: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on history\deleted folder, delete content and create new folder is necessary"
Write-Host "            Step 7.15: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on tester\caches folder, delete content and create new folder is necessary"
Write-Host "            Step 7.16: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on tester\files folder, delete content and create new folder is necessary"
Write-Host "            Step 7.17: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on tester\history folder, delete content and create new folder is necessary"
Write-Host "            Step 7.18: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on tester\logs folder, delete content and create new folder is necessary"
Write-Host "            Step 7.19: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: About on profiles\default folder, delete content and create new folder is necessary"
Write-Host "            Step 7.20: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: Open all MetaTrader 4"
Write-Host "            Step 7.21: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: Run all previous step in OneClick"
Write-Host "            Step 7.22: Build requirements to run this script -> Create additional file in powershell to make all menu operational :: Close this script"
Write-Host "        Step 8: Build requirements to run this script -> Create empty extra script for when the close this script when press x button"
Write-Host "        Step 9: Build requirements to run this script -> Create extra script for when the close this script when press x button"
Write-Host "        Step 10: Run main script PSScriptMenuGui all options"
Write-Host "        Step 11: Build requirements to run this script -> Clear windows variables generated previously"
Write-Host "        Step 12: Warning before running script"
Write-Host "        Step 13: Run menu"
Write-Host "        Step 14: Build requirements to run this script -> Run secondary script generated in hidden process"

# Step 1: Build requirements to run this script -> Remove on previous files used
Write-Host "Step 1: Build requirements to run this script -> Remove on previous files used"
Remove-Item "C:\TEMP\CLEARMT4SETUP\Baseline" -Force -Recurse
Remove-Item "C:\TEMP\CLEARMT4SETUP\BatchFile" -Force -Recurse
Remove-Item "C:\TEMP\CLEARMT4SETUP\Extras" -Force -Recurse
Remove-Item "C:\TEMP\CLEARMT4SETUP\Logs" -Force -Recurse
Remove-Item "C:\TEMP\CLEARMT4SETUP\PowerShell" -Force -Recurse

# Step 2: Build requirements to run this script -> Build folder structure necessary
Write-Host "Step 2: Build requirements to run this script -> Build folder structure necessary"
New-Item -ItemType Directory -Path "C:\TEMP\CLEARMT4SETUP\Baseline"
New-Item -ItemType Directory -Path "C:\TEMP\CLEARMT4SETUP\BatchFile"
New-Item -ItemType Directory -Path "C:\TEMP\CLEARMT4SETUP\Extras"
New-Item -ItemType Directory -Path "C:\TEMP\CLEARMT4SETUP\Logs"
New-Item -ItemType Directory -Path "C:\TEMP\CLEARMT4SETUP\PowerShell"

# Step 3: Build requirements to run this script -> Declare windows variable
Write-Host "Step 3: Build requirements to run this script -> Declare windows variable"
$env:CLEARMT4SETUPBaseline = 'C:\TEMP\CLEARMT4SETUP\Baseline'
$env:CLEARMT4SETUPBatchFile = 'C:\TEMP\CLEARMT4SETUP\BatchFile'
$env:CLEARMT4SETUPExtras = 'C:\TEMP\CLEARMT4SETUP\Extras'
$env:CLEARMT4SETUPLogs = 'C:\TEMP\CLEARMT4SETUP\Logs'
$env:CLEARMT4SETUPPowerShell = 'C:\TEMP\CLEARMT4SETUP\PowerShell'

# Step 4: Build requirements to run this script -> Create empty file for using on this menu
Write-Host "Step 4: Build requirements to run this script -> Create empty file for using on this menu"
New-Item "$env:CLEARMT4SETUPBaseline\BuildMENU.csv"

# Step 5: Build requirements to run this script -> Create csv file for using on build menu
Write-Host "Step 5: Build requirements to run this script -> Create csv file for using on build menu"
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'Section,Method,Command,Arguments,Name,Description'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-01.cmd,,1,"About on logs folder, delete older than 14 days"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-02.cmd,,2,"About on MQL4\Common folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-03.cmd,,3,"About on MQL4\Experts folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-04.cmd,,4,"About on MQL4\Images folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-05.cmd,,5,"About on MQL4\Files folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-06.cmd,,6,"About on MQL4\Include folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-07.cmd,,7,"About on MQL4\Indicators folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-08.cmd,,8,"About on MQL4\Libraries folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-09.cmd,,9,"About on MQL4\Logs folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-10.cmd,,10,"About on MQL4\Presets folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-11.cmd,,11,"About on MQL4\Scripts folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-12.cmd,,12,"About on MQL4\Sounds folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-13.cmd,,13,"About on history\mailbox folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-14.cmd,,14,"About on history\deleted folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-15.cmd,,15,"About on tester\caches folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-16.cmd,,16,"About on tester\files folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-17.cmd,,17,"About on tester\history folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-18.cmd,,18,"About on tester\logs folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-19.cmd,,19,"About on profiles\default folder, delete content, and next create folder is necessary"'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-20.cmd,,20,Open all MetaTrader 4'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-21.cmd,,21,Run all previous step in OneClick'
Add-Content "$env:CLEARMT4SETUPBaseline\BuildMENU.csv" 'MetaTrader 4 - Clear history,cmd,C:\TEMP\CLEARMT4SETUP\BatchFile\04-22.cmd,,22,Close this script'

# Step 6: Build requirements to run this script -> Create empty necessary additional files in batch to make all menu operational
Write-Host "Step 6: Build requirements to run this script -> Create empty necessary additional files in batch to make all menu operational"
New-Item $env:CLEARMT4SETUPBatchFile\04-01.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-01.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-02.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-03.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-04.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-05.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-06.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-07.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-08.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-10.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-11.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-12.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-13.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-14.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-15.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-16.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-17.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-18.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-18.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-19.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-20.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-21.cmd
New-Item $env:CLEARMT4SETUPBatchFile\04-22.cmd

# Step 6.1: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on logs folder, delete older than 14 days
Write-Host "Step 6.1: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on logs folder, delete older than 14 days"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-01.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-01.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-01.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-01.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-01.cmd" 'powershell.exe -file "07-01.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-01.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-01.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-01.cmd" ''

# Step 6.2: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Common folder, delete content
Write-Host "Step 6.2: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Common folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-02.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-02.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-02.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-02.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-02.cmd" 'powershell.exe -file "07-02.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-02.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-02.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-02.cmd" ''

# Step 6.3: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Experts folder, delete content
Write-Host "Step 6.3: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Experts folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-03.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-03.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-03.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-03.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-03.cmd" 'powershell.exe -file "07-03.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-03.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-03.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-03.cmd" ''

# Step 6.4: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Images folder, delete content
Write-Host "Step 6.4: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Images folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-04.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-04.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-04.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-04.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-04.cmd" 'powershell.exe -file "07-04.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-04.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-04.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-04.cmd" ''

# Step 6.5: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Files folder, delete content
Write-Host "Step 6.5: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Files folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-05.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-05.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-05.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-05.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-05.cmd" 'powershell.exe -file "07-05.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-05.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-05.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-05.cmd" ''

# Step 6.6: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Include folder, delete content
Write-Host "Step 6.6: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Include folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-06.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-06.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-06.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-06.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-06.cmd" 'powershell.exe -file "07-06.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-06.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-06.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-06.cmd" ''

# Step 6.7: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Indicators folder, delete content
Write-Host "Step 6.7: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Indicators folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-07.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-07.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-07.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-07.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-07.cmd" 'powershell.exe -file "07-07.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-07.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-07.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-07.cmd" ''

# Step 6.8: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Libraries folder, delete content
Write-Host "Step 6.8: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Libraries folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-08.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-08.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-08.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-08.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-08.cmd" 'powershell.exe -file "07-08.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-08.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-08.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-08.cmd" ''

# Step 6.9: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Logs folder, delete content
Write-Host "Step 6.9: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Logs folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-09.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-09.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-09.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-09.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-09.cmd" 'powershell.exe -file "07-09.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-09.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-09.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-09.cmd" ''

# Step 6.10: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Presets folder, delete content
Write-Host "Step 6.10: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Presets folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-10.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-10.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-10.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-10.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-10.cmd" 'powershell.exe -file "07-10.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-10.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-10.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-10.cmd" ''

# Step 6.11: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Scripts folder, delete content
Write-Host "Step 6.11: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Scripts folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-11.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-11.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-11.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-11.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-11.cmd" 'powershell.exe -file "07-11.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-11.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-11.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-11.cmd" ''

# Step 6.12: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Sounds folder, delete content
Write-Host "Step 6.12: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Sounds folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-12.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-12.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-12.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-12.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-12.cmd" 'powershell.exe -file "07-12.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-12.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-12.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-12.cmd" ''

# Step 6.13: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on history\mailbox folder, delete content
Write-Host "Step 6.13: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on history\mailbox folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-13.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-13.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-13.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-13.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-13.cmd" 'powershell.exe -file "07-13.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-13.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-13.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-13.cmd" ''

# Step 6.14: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on history\deleted folder, delete content
Write-Host "Step 6.14: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on history\deleted folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-14.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-14.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-14.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-14.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-14.cmd" 'powershell.exe -file "07-14.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-14.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-14.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-14.cmd" ''

# Step 6.15: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\caches folder, delete content
Write-Host "Step 6.15: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\caches folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-15.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-15.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-15.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-15.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-15.cmd" 'powershell.exe -file "07-15.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-15.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-15.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-15.cmd" ''

# Step 6.16: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\files folder, delete content
Write-Host "Step 6.16: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\files folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-16.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-16.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-16.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-16.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-16.cmd" 'powershell.exe -file "07-16.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-16.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-16.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-16.cmd" ''

# Step 6.17: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\history folder, delete content
Write-Host "Step 6.17: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\history folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-17.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-17.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-17.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-17.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-17.cmd" 'powershell.exe -file "07-17.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-17.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-17.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-17.cmd" ''

# Step 6.18: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\logs folder, delete content
Write-Host "Step 6.18: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\logs folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-18.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-18.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-18.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-18.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-18.cmd" 'powershell.exe -file "07-18.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-18.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-18.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-18.cmd" ''

# Step 6.19: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on profiles\default folder, delete content
Write-Host "Step 6.19: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on profiles\default folder, delete content"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-19.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-19.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-19.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-19.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-19.cmd" 'powershell.exe -file "07-19.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-19.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-19.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-19.cmd" ''

# Step 6.20: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Open all MetaTrader 4
Write-Host "Step 6.20: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Open all MetaTrader 4"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-20.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-20.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-20.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-20.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-20.cmd" 'powershell.exe -file "07-20.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-20.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-20.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-20.cmd" ''

# Step 6.21: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Run all previous step in OneClick
Write-Host "Step 6.21: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Run all previous step in OneClick"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-21.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-21.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-21.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-21.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-21.cmd" 'powershell.exe -file "07-21.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-21.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-21.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-21.cmd" ''

# Step 6.22: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Close this script
Write-Host "Step 6.22: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Close this script"
Add-Content "$env:CLEARMT4SETUPBatchFile\04-22.cmd" ':: Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-22.cmd" 'echo Go to specific location to run powershell'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-22.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-22.cmd" 'cd "C:\TEMP\CLEARMT4SETUP\PowerShell"'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-22.cmd" 'powershell.exe -file "07-22.ps1" -Verb RunAs'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-22.cmd" ''
Add-Content "$env:CLEARMT4SETUPBatchFile\04-22.cmd" 'exit 0'
Add-Content "$env:CLEARMT4SETUPBatchFile\04-22.cmd" ''

# Step 7: Build requirements to run this script -> Create additional file in batch to make all menu operational
Write-Host "Step 7: Build requirements to run this script -> Create additional file in batch to make all menu operational"
New-Item $env:CLEARMT4SETUPPowerShell\07-01.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-01.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-02.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-03.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-04.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-05.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-06.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-07.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-08.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-09.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-10.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-11.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-12.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-13.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-14.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-15.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-16.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-17.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-18.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-19.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-20.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-21.ps1
New-Item $env:CLEARMT4SETUPPowerShell\07-22.ps1

# Step 7.1: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on logs folder, delete older than 14 days and create new folder is necessary
Write-Host "Step 7.1: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on logs folder, delete older than 14 days and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-01.ps1" '# About on logs folder, delete older than 14 days'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-01.ps1" 'Write-Host "About on logs folder, delete older than 14 days"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-01.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\logs -Recurse | Where-Object {$_.Lastwritetime -lt (Get-Date).adddays(-13)} | Remove-Item'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-01.ps1" ''

# Step 7.2: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Common folder, delete content and create new folder is necessary
Write-Host "Step 7.2: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Common folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-02.ps1" '# About on MQL4\Common folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-02.ps1" 'Write-Host "About on MQL4\Common folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-02.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\Common | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-02.ps1" 'Remove-Item $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\Common -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-02.ps1" ''

# Step 7.3: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Experts folder, delete content and create new folder is necessary
Write-Host "Step 7.3: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Experts folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-03.ps1" '# About on MQL4\Experts folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-03.ps1" 'Write-Host "About on MQL4\Experts folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-03.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Experts | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-03.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-03.ps1" '# About on MQL4\Experts folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-03.ps1" 'Write-Host "About on MQL4\Experts folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-03.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Experts'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-03.ps1" ''

# Step 7.4: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Images folder, delete content and create new folder is necessary
Write-Host "Step 7.4: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Images folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-04.ps1" '# About on MQL4\Images folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-04.ps1" 'Write-Host "About on MQL4\Images folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-04.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Images | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-04.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-04.ps1" '# About on MQL4\Images folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-04.ps1" 'Write-Host "About on MQL4\Images folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-04.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Images'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-04.ps1" ''

# Step 7.5: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Files folder, delete content and create new folder is necessary
Write-Host "Step 7.5: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Files folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-05.ps1" '# About on MQL4\Files folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-05.ps1" 'Write-Host "About on MQL4\Files folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-05.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Files | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-05.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-05.ps1" '# About on MQL4\Files folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-05.ps1" 'Write-Host "About on MQL4\Files folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-05.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Files'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-05.ps1" ''

# Step 7.6: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Include folder, delete content and create new folder is necessary
Write-Host "Step 7.6: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Include folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-06.ps1" '# About on MQL4\Include folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-06.ps1" 'Write-Host "About on MQL4\Include folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-06.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include -Recurse  | Where-Object {(($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Arrays*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Canvas*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\ChartObjects*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Charts*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Controls*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Files*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Indicators*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Strings*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Tools*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\MovingAverages.mqh*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Object.mqh*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\stderror.mqh*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\stdlib.mqh*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\StdLibErr.mqh*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\WinUser32.mqh*'))} | Remove-Item -Recurse'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-06.ps1" ''

# Step 7.7: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Indicators folder, delete content and create new folder is necessary
Write-Host "Step 7.7: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Indicators folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-07.ps1" '# About on MQL4\Indicators folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-07.ps1" 'Write-Host "About on MQL4\Indicators folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-07.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Indicators | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-07.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-07.ps1" '# About on MQL4\Indicators folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-07.ps1" 'Write-Host "About on MQL4\Indicators folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-07.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Indicators'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-07.ps1" ''

# Step 7.8: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Libraries folder, delete content and create new folder is necessary
Write-Host "Step 7.8: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Libraries folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-08.ps1" '# About on MQL4\Libraries folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-08.ps1" 'Write-Host "About on MQL4\Libraries folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-08.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Libraries -Recurse  | Where-Object {(($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Libraries\stdlib.ex4') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Libraries\stdlib.mq4*'))} | Remove-Item -Recurse'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-08.ps1" ''

# Step 7.9: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Logs folder, delete content and create new folder is necessary
Write-Host "Step 7.9: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Logs folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-09.ps1" '# About on MQL4\Logs folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-09.ps1" 'Write-Host "About on MQL4\Logs folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-09.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Logs -Recurse | Where-Object {$_.Lastwritetime -lt (Get-Date).adddays(-13)} | Remove-Item'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-09.ps1" ''

# Step 7.10: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Presets folder, delete content and create new folder is necessary
Write-Host "Step 7.10: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Presets folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-10.ps1" '# About on MQL4\Presets folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-10.ps1" 'Write-Host "About on MQL4\Presets folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-10.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Presets | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-10.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-10.ps1" '# About on MQL4\Presets folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-10.ps1" 'Write-Host "About on MQL4\Presets folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-10.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Presets'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-10.ps1" ''

# Step 7.11: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Scripts folder, delete content and create new folder is necessary
Write-Host "Step 7.11: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Scripts folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-11.ps1" '# About on MQL4\Scripts folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-11.ps1" 'Write-Host "About on MQL4\Scripts folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-11.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Scripts | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-11.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-11.ps1" '# About on MQL4\Scripts folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-11.ps1" 'Write-Host "About on MQL4\Scripts folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-11.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Scripts'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-11.ps1" ''

# Step 7.12: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Sounds folder, delete content and create new folder is necessary
Write-Host "Step 7.12: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on MQL4\Sounds folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-12.ps1" '# About on MQL4\Sounds folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-12.ps1" 'Write-Host "About on MQL4\Sounds folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-12.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Sounds | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-12.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-12.ps1" '# About on MQL4\Sounds folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-12.ps1" 'Write-Host "About on MQL4\Sounds folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-12.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Sounds'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-12.ps1" ''

# Step 7.13: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on history\mailbox folder, delete content and create new folder is necessary
Write-Host "Step 7.13: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on history\mailbox folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-13.ps1" '# About on history\mailbox folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-13.ps1" 'Write-Host "About on history\mailbox folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-13.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\history\mailbox | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-13.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-13.ps1" '# About on history\mailbox folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-13.ps1" 'Write-Host "About on history\mailbox folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-13.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\history -Name mailbox'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-13.ps1" ''

# Step 7.14: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on history\deleted folder, delete content and create new folder is necessary
Write-Host "Step 7.14: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on history\deleted folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-14.ps1" '# About on history\deleted folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-14.ps1" 'Write-Host "About on history\deleted folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-14.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\history\deleted | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-14.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-14.ps1" '# About on history\deleted folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-14.ps1" 'Write-Host "About on history\deleted folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-14.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\history -Name deleted'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-14.ps1" ''

# Step 7.15: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\caches folder, delete content and create new folder is necessary
Write-Host "Step 7.15: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\caches folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-15.ps1" '# About on tester\caches folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-15.ps1" 'Write-Host "About on tester\caches folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-15.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester\caches | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-15.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-15.ps1" '# About on tester\caches folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-15.ps1" 'Write-Host "About on tester\caches folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-15.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester -Name caches'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-15.ps1" ''

# Step 7.16: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\files folder, delete content and create new folder is necessary
Write-Host "Step 7.16: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\files folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-16.ps1" '# About on tester\files folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-16.ps1" 'Write-Host "About on tester\files folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-16.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester\files | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-16.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-16.ps1" '# About on tester\files folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-16.ps1" 'Write-Host "About on tester\files folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-16.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester -Name files'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-16.ps1" ''

# Step 7.17: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\history folder, delete content and create new folder is necessary
Write-Host "Step 7.17: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\history folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-17.ps1" '# About on tester\history folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-17.ps1" 'Write-Host "About on tester\history folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-17.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester\history | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-17.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-17.ps1" '# About on tester\history folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-17.ps1" 'Write-Host "About on tester\history folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-17.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester -Name history'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-17.ps1" ''

# Step 7.18: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\logs folder, delete content and create new folder is necessary
Write-Host "Step 7.18: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on tester\logs folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-18.ps1" '# About on tester\logs folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-18.ps1" 'Write-Host "About on tester\logs folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-18.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester\logs | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-18.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-18.ps1" '# About on tester\logs folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-18.ps1" 'Write-Host "About on tester\logs folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-18.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester -Name logs'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-18.ps1" ''

# Step 7.19: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on profiles\default folder, delete content and create new folder is necessary
Write-Host "Step 7.19: Build requirements to run this script -> Create additional file in batch to make all menu operational :: About on profiles\default folder, delete content and create new folder is necessary"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-19.ps1" '# About on profiles\default folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-19.ps1" 'Write-Host "About on profiles\default folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-19.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\profiles\default | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-19.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-19.ps1" '# About on tester\logs folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-19.ps1" 'Write-Host "About on tester\logs folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-19.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\profiles -Name default'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-19.ps1" ''

# Step 7.20: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Open all MetaTrader 4
Write-Host "Step 7.20: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Open all MetaTrader 4"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-20.ps1" '# Open all MetaTrader 4'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-20.ps1" 'Write-Host "Open all MetaTrader 4"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-20.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-20.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-20.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-20.ps1" ''

# Step 7.21: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Run all previous step in OneClick
Write-Host "Step 7.21: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Run all previous step in OneClick"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# Run all previous step in OneClick'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "Run all previous step in OneClick"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# Restart Windows Explorer'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "Restart Windows Explorer"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'taskkill /f /im explorer.exe /t'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Start-Process explorer.exe'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# Restart and Terminate all process MetaTrader 4'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "Restart and Terminate all process MetaTrader 4"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'taskkill /f /im terminal.exe /t'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on logs folder, delete older than 14 days'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on logs folder, delete older than 14 days"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\logs -Recurse | Where-Object {$_.Lastwritetime -lt (Get-Date).adddays(-22)} | Remove-Item'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Common folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Common folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\Common | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Remove-Item $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\Common -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Experts folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Experts folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Experts | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Experts folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Experts folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Experts'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Images folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Images folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Images | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Images folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Images folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Images'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Files folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Files folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Files | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Files folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Files folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Files'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Include folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Include folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include -Recurse  | Where-Object {(($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Arrays*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Canvas*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\ChartObjects*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Charts*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Controls*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Files*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Indicators*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Strings*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Tools*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\MovingAverages.mqh*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\Object.mqh*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\stderror.mqh*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\stdlib.mqh*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\StdLibErr.mqh*') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Include\WinUser32.mqh*'))} | Remove-Item -Recurse'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Indicators folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Indicators folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Indicators | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Indicators folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Indicators folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Indicators'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Libraries folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Libraries folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Libraries -Recurse  | Where-Object {(($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Libraries\stdlib.ex4') -and ($_.FullName -notlike 'C:\Users\*\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Libraries\stdlib.mq4*'))} | Remove-Item -Recurse'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Logs folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Logs folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Logs -Recurse | Where-Object {$_.Lastwritetime -lt (Get-Date).adddays(-22)} | Remove-Item'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Presets folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Presets folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Presets | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Presets folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Presets folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Presets'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Scripts folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Scripts folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Scripts | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Scripts folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Scripts folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Scripts'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Sounds folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Sounds folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4\Sounds | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on MQL4\Sounds folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on MQL4\Sounds folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\MQL4 -Name Sounds'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on history\mailbox folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on history\mailbox folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\history\mailbox | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on history\mailbox folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on history\mailbox folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\history -Name mailbox'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on history\deleted folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on history\deleted folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\history\deleted | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on history\deleted folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on history\deleted folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\history -Name deleted'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on tester\caches folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on tester\caches folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester\caches | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on tester\caches folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on tester\caches folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester -Name caches'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on tester\files folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on tester\files folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester\files | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on tester\files folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on tester\files folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester -Name files'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on tester\history folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on tester\history folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester\history | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on tester\history folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on tester\history folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester -Name history'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on tester\logs folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on tester\logs folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester\logs | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on tester\logs folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on tester\logs folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\tester -Name logs'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on profiles\default folder, delete content'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on profiles\default folder, delete content"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Get-ChildItem $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\profiles\default | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" '# About on tester\logs folder, and create new folder'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'Write-Host "About on tester\logs folder, and create new folder"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" 'New-Item -Type Directory -Path $env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\*\profiles -Name default'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-21.ps1" ''

# Step 7.22: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Close this script
Write-Host "Step 7.22: Build requirements to run this script -> Create additional file in batch to make all menu operational :: Close this script"
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" '# Close this script'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" 'Write-Host "Close this script"'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" ''
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" 'taskkill /F /FI "WINDOWTITLE eq Extra script for monitoring process real time" /T'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" 'rd "C:\TEMP\CLEARMT4SETUP\Baseline\" -Recurse -Force -Confirm:$false'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" 'rd "C:\TEMP\CLEARMT4SETUP\BatchFile\" -Recurse -Force -Confirm:$false'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" 'rd "C:\TEMP\CLEARMT4SETUP\Extras\" -Recurse -Force -Confirm:$false'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" 'rd "C:\TEMP\CLEARMT4SETUP\Logs\" -Recurse -Force -Confirm:$false'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" 'rd "C:\TEMP\CLEARMT4SETUP\PowerShell\" -Recurse -Force -Confirm:$false'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" 'rd "C:\TEMP\CLEARMT4SETUP\" -Recurse -Force -Confirm:$false'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" 'taskkill /F /FI "WINDOWTITLE eq www.forex-station.com" /T'
Add-Content "$env:CLEARMT4SETUPPowerShell\07-22.ps1" ''

# Step 8: Build requirements to run this script -> Create empty extra script for when the close this script when press x button
Write-Host "Step 8: Build requirements to run this script -> Create empty extra script for when the close this script when press x button"
New-Item "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1"

# Step 9: Build requirements to run this script -> Create extra script for when the close this script when press x button
Write-Host "Step 9: Build requirements to run this script -> Create extra script for when the close this script when press x button"
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" '# Extra script for monitoring process real time'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Write-Host "Extra script for monitoring process real time"'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" '$host.ui.RawUI.WindowTitle = "Extra script for monitoring process real time"'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" ''
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Start-Sleep -Seconds 20'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" '$processTitle = @('
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" '    "www.forex-station.com" #or whatever you want to monitor'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" ')'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" ''
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Do {  '
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" '    $ProcessesFound = Get-Process | Where-Object { $_.MainWindowTitle -eq $processTitle}'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" '    If ($ProcessesFound) {'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" '        Write-Host "Still running: $($ProcessesFound)"'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" '        Start-Sleep -Seconds 20'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" '    }'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" '} Until (!$ProcessesFound)'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item "C:\TEMP\CLEARMT4SETUP\Baseline" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item "C:\TEMP\CLEARMT4SETUP\BatchFile" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item "C:\TEMP\CLEARMT4SETUP\Extras" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item "C:\TEMP\CLEARMT4SETUP\Logs" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item "C:\TEMP\CLEARMT4SETUP\PowerShell" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item "C:\TEMP\CLEARMT4SETUP" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item -LiteralPath "C:\TEMP\CLEARMT4SETUP\Baseline" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item -LiteralPath "C:\TEMP\CLEARMT4SETUP\BatchFile" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item -LiteralPath "C:\TEMP\CLEARMT4SETUP\Extras" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item -LiteralPath "C:\TEMP\CLEARMT4SETUP\Logs" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item -LiteralPath "C:\TEMP\CLEARMT4SETUP\PowerShell" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'Remove-Item -LiteralPath "C:\TEMP\CLEARMT4SETUP" -Force -Recurse'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" 'exit 0'
Add-Content "$env:CLEARMT4SETUPExtras\SecondaryPowershellScript.ps1" ''

# Step 10: Run main script PSScriptMenuGui all options
# Source at: https://github.com/dan-osull/PowerShell-Script-Menu-Gui/blob/master/PSScriptMenuGui/examples/PSScriptMenuGui_all_options.ps1
Write-Host "Step 11: Run main script PSScriptMenuGui all options"
$host.ui.RawUI.WindowTitle = "PSScriptMenuGui all options"

# Start region setup 
Set-Location $PSScriptRoot
Remove-Module PSScriptMenuGui -ErrorAction SilentlyContinue
try {
    Import-Module PSScriptMenuGui -ErrorAction Stop
}
catch {
    Write-Warning $_
    Write-Verbose 'Attempting to import from parent directory...' -Verbose
    Import-Module '..\'
}

$params = @{
    csvPath = 'C:\TEMP\CLEARMT4SETUP\Baseline\BuildMENU.csv'
    windowTitle = 'www.forex-station.com'
    buttonForegroundColor = 'Azure' 
    buttonBackgroundColor = '#080808'
    noExit = $false
    Verbose = $true
}

# Step 11: Build requirements to run this script -> Clear windows variables generated previously
Write-Host "Step 11: Build requirements to run this script -> Clear windows variables generated previously"
$env:CLEARMT4SETUPBaseline = ''
$env:CLEARMT4SETUPBatchFile = ''
$env:CLEARMT4SETUPPowerShell = ''
$env:CLEARMT4SETUPExtras = ''
$env:CLEARMT4SETUPLog = ''

# Step 12: Warning before running script
Write-Host "Step 12: Warning before running script"
$sh = New-Object -ComObject "Wscript.Shell"
$sh.Popup("Before using, atention this applies to all MetaTrader 4 installed on this computer", 5, "CLEARMT4SETUP.ps1", 0 + 64)

# Step 13: Run menu
Write-Host "Step 13: Run menu"
Show-ScriptMenuGui @params 

# Step 14: Build requirements to run this script -> Run secondary script generated in hidden process
Write-Host "Step 14: Build requirements to run this script -> Run secondary script generated in hidden process"
C:\TEMP\CLEARMT4SETUP\Extras\SecondaryPowershellScript.ps1
These users thanked the author Curioso for the post (total 6):
Jimmy, boytoy, ChuChu Rocket, Ogee, moey_dw, ionone


Re: Metatrader and powershell

3
Hello Friends,

For the people are continuous working in indicators and experts and need control versions, i share with you a script to build a Schedule Task run every minute and next create the script automatic.

Is powershell script, so save as ps1 file and to your location and atention at this 2 points:
# Source of your repository
$RootFolder = "C:\SourceFolder"

# Destiny folder for the files classified with version
$Destination = "C:\DestinationFolder"

Code: Select all

###############################################
# Create of task schedule if there not exists with this script
$TaskName = "Control versions for MetaTrader 4"

# Check if the schedule task exists
if (Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue) {
    Write-Host "The schedule task '$TaskName' already exists, to this script will not take any action"
} else {
    Write-Host "The schedule task '$TaskName' not exists. Then wait while this process is finished"

    ############################################### 
    # Control versions of indicators and experts based on property version
    Write-Host "Control versions of indicators and experts based on property version"
    $host.ui.RawUI.WindowTitle = "Control versions of indicators and experts based on property version"
    Write-Host "Resume what is does this specific task"
    Write-Host "       Step 1: Control versions of indicators and experts based on property version"
    Write-Host "           Step 1.1: Control versions of indicators and experts based on property version :: Create task schedule"
    Write-Host "           Step 1.2: Control versions of indicators and experts based on property version :: Create necessary script"
    Write-Host "           Step 1.3: Control versions of indicators and experts based on property version :: Add necessary and missed information"
    Write-Host "                Step 1.3.1: Control versions of indicators and experts based on property version :: Declare source file"
    Write-Host "                Step 1.3.2: Control versions of indicators and experts based on property version :: Line necessary to add missed information"
    Write-Host "                Step 1.3.3: Control versions of indicators and experts based on property version :: Text to be add"
    Write-Host "                Step 1.3.4: Control versions of indicators and experts based on property version :: Read entire file"
    Write-Host "                Step 1.3.5: Control versions of indicators and experts based on property version :: Add the information need"
    Write-Host "                Step 1.3.6: Control versions of indicators and experts based on property version :: Write the updated lines back to the file"
    Write-Host "           Step 1.4: Control versions of indicators and experts based on property version :: Stop this script"

    ###############################################
    # Control versions of indicators and experts based on property version
    # Step 1: Control versions of indicators and experts based on property version

    # Step 1.1: Control versions of indicators and experts based on property version :: Create task schedule
    $action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument 'C:\SCRIPTS\MT-ControlVersions.ps1}'
    $trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 1)
    $principal = New-ScheduledTaskPrincipal -UserId "$env:USERDOMAIN\$env:USERNAME" -LogonType "S4U" -RunLevel Highest
    Register-ScheduledTask -TaskName "TRADING\Control versions for MetaTrader 4" -Action $action -Trigger $trigger -Principal $principal -Force
    $TaskSettings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
    Set-ScheduledTask -TaskName "TRADING\Control versions for MetaTrader 4" -Settings $TaskSettings

    # Step 1.2: Control versions of indicators and experts based on property version :: Create necessary script
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '# Source of your repository'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '$RootFolder = "C:\SourceFolder"'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" ' '
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '# Destiny folder for the files classified with version'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '$Destination = "C:\DestinationFolder"'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" ' '
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '# Obtém todos os arquivos no diretório de origem'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '$Files = Get-ChildItem -Path $RootFolder -File -Recurse'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" ' '
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '# File interaction'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" 'foreach ($File in $Files) {'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" ' '
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '# Read the content of every file'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '$Content = Get-Content -Path $File.FullName'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" ' '
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '# Find for the line contains the information property version'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '$VersionLine = $Content | Where-Object { $_ -match "property version" }'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" ' '
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '# If is valid so'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" 'if ($VersionLine) {'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" ' '
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '# Extract a version for that'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '$Version = $VersionLine -replace "property version", "" -replace ''([A-Z]| |#|")', ''
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" ' '
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '      # Create the destination folder, with base on version and name of file'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '      $DestinationPath = Join-Path -Path $Destination -ChildPath "$Version\$($File.BaseName)"'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" ' ' 
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '      # And if the folder of destionation does not exist, so create that one'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '      if (-not (Test-Path -Path $DestinationPath)) {'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '          New-Item -Path $DestinationPath -ItemType Directory'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '      }'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" ' '
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" '      # Copy the file for destination'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" 'Copy-Item -Path $File.FullName -Destination $DestinationPath -Force'
    Add-Content "C:\SCRIPTS\MT-ControlVersions.ps1" ' '

    # Step 1.3: Control versions of indicators and experts based on property version :: Add necessary and missed information
    # Step 1.3.1: Control versions of indicators and experts based on property version :: Declare source file
    $FileToCorrect = "C:\SCRIPTS\MT-ControlVersions.ps1"

    # Step 1.3.2: Control versions of indicators and experts based on property version :: Line necessary to add missed information
    $Line = 23

    # Step 1.3.3: Control versions of indicators and experts based on property version :: Text to be add
    $txtADD = "', ''"

    # Step 1.3.4: Control versions of indicators and experts based on property version :: Read entire file
    $Lines = Get-Content -Path $FileToCorrect

    # Step 1.3.5: Control versions of indicators and experts based on property version :: Add the information need
    $Lines[$Line - 1] += $txtADD

    # Step 1.3.6: Control versions of indicators and experts based on property version :: Write the updated lines back to the file
    $Lines | Set-Content -Path $FileToCorrect

    # Step 1.3: Control versions of indicators and experts based on property version :: Stop this script
    $sh = New-Object -ComObject "Wscript.Shell"
    $sh.Popup("The creation of this task schedule task is conclude", 2, "www.forex-station.com", 0 + 64)

}

I hope you enjoy that one
These users thanked the author Curioso for the post:
boytoy


Who is online

Users browsing this forum: DotNetDotCom [Bot], Trendiction [Bot] and 21 guests