@{
ModuleVersion = '1.0'
GUID = '72d739dd-bddf-4d7c-a358-1a40e2ff961d'
Description = 'test module'
NestedModules = @('testmodule.psm1')
}
function get-tf1 {
'tf1'
}
WindowsPowerShell/
Modules/
Scripts/
Microsoft.PowerShell_profile.ps1
$home = Split-Path $profile
$env:Path += (";{0}\Scripts" -f $home)
pomoika/
assorted/
pomoika.psd1 (содержимое опущено)
pomoika.pm1:
Try {
Get-ChildItem "$PSScriptRoot\assorted\*.ps1" -Exclude *.tests.ps1, *profile.ps1 | ForEach-Object {
$Function = $_.Name
. $_.FullName
}
} Catch {
Write-Warning ("{0}: {1}" -f $Function,$_.Exception.Message)
Continue
}
консоль в VSCode.
Get-PSDrive | Select-Object *
- без двоеточия в концеforeach (var prop in obj.Properties)
{
Console.WriteLine("{0,20}: {1}", prop.Name, prop.Value);
}
Aliases created by using New-Alias are not saved after you exit the session or close Windows PowerShell. You can use the Export-Alias cmdlet to save your alias information to a file. You can later use Import-Alias to retrieve that saved alias information.
$code = "xxx"
$Chat_ID = "xxx"
$filename = 'd:\mydoc.txt'
$uri = "https://api.telegram.org/bot$code/sendDocument"
Add-Type -AssemblyName System.Net.Http
$form = new-object System.Net.Http.MultipartFormDataContent
$chatId = New-Object System.Net.Http.StringContent $Chat_ID
$form.Add($chatId, 'chat_id')
$fileContent = Get-Content $filename -Encoding Byte
$byteContent = New-Object System.Net.Http.ByteArrayContent ($fileContent, 0, $fileContent.Length)
$byteContent.Headers.Add('Content-Type','text/plain')
$form.Add($byteContent, 'document', 'mydoc.txt')
$ms = new-object System.IO.MemoryStream
$ca = $form.CopyToAsync($ms)
$ca.Wait()
Invoke-WebRequest -Method Post -Body $ms.ToArray() -Uri $uri -ContentType $form.Headers.ContentType.ToString()
-replace ".*<xml_catalog", "<xml_catalog"
выглядит менее страшно IMHO безо всех этих просмотров назад-вперёд :)