Last active
July 5, 2022 03:17
-
-
Save bhavjot/6d29d5fc9514078a50867f1701454c9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#copying | |
Write-Host "Copying charts.." | |
Copy-Item "sorceaddress" -Destination "destaddress" -Recurse | |
$todayDate = Get-Date -UFormat "%Y%m%d" | |
#rename file | |
Rename-Item sourcefile.CSV newname.CSV | |
$pinfo = New-Object System.Diagnostics.ProcessStartInfo | |
$pinfo.FileName = "exename" | |
$pinfo.RedirectStandardError = $true | |
$pinfo.RedirectStandardOutput = $true | |
$pinfo.UseShellExecute = $false | |
$pinfo.Arguments = "" | |
$p = New-Object System.Diagnostics.Process | |
$p.StartInfo = $pinfo | |
$p.Start() | Out-Null | |
#Do Other Stuff Here.... | |
$p.WaitForExit() | |
$p.ExitCode | |
if ($p.ExitCode -ne 0) { | |
Write-Warning "$_ exited with status code $($p.ExitCode)" | |
} | |
#--------------------------------- | |
# To kill Process | |
STOP-PROCESS | |
# To start a command | |
INVOKE-COMMAND | |
#Set Location - current working directory to specific location | |
SET-LOCATION | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run this command before running file
Set-Executionpolicy -Scope CurrentUser -ExecutionPolicy UnRestricted
At end
Set-Executionpolicy -Scope CurrentUser -ExecutionPolicy Restricted