Benutzer:MovGP0/Powershell
Zur Navigation springen
Zur Suche springen
MovGP0 | Über mich | Hilfen | Artikel | Weblinks | Literatur | Zitate | Notizen | Programmierung | MSCert | Physik |
Powershell[Bearbeiten | Quelltext bearbeiten]Umgebungsvariablen[Bearbeiten | Quelltext bearbeiten]
# get the correct directory
$programPath = if ((${env:ProgramFiles(x86)}).Length -eq 0)
{
${env:ProgramFiles}
}
else
{
${env:ProgramFiles(x86)}
}
# create the path to add to the path variable
$pathToAdd = "$programPath\Java\jdk1.6.0_03\bin"
# get the current value for path
$currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
# create the new value for path
$newPath = "$currentPath;$pathToAdd"
# variant1: set the path with the registry provider
Set-ItemProperty -Path 'Registry::HKLM\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH –Value $newPath
# variant2: set the path with the .NET framework
[Environment]::SetEnvironmentVariable( "Path", $newPath, [System.EnvironmentVariableTarget]::Machine )
Note: use
Set-ItemProperty -path HKEY_LOCAL_MACHINE:Software\Policies\Microsoft\Windows\DeliveryOptimization -name DODownloadMode -value 3
Sonstiges[Bearbeiten | Quelltext bearbeiten]
dumpbin /headers PROGRAMMODERDLL
$PSVersionTable.PSVersion
Find-DscResource
Import-DscResource -ModuleName "..."
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = "C:\Users\johann.dirry\AppData\Roaming\npm\gulp.cmd"
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $true
$pinfo.UseShellExecute = $false
$pinfo.Arguments = "test:build test:exec"
$pinfo.WorkingDirectory = "C:\Development\projects\sbb\RailBaggage\Web\WebApp"
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start()
$stdout = $p.StandardOutput.ReadToEnd()
$stderr = $p.StandardError.ReadToEnd()
$exitcode = $p.ExitCode
[System.Console]::WriteLine($stdout)
Administration[Bearbeiten | Quelltext bearbeiten]
Text UI Libraries[Bearbeiten | Quelltext bearbeiten]
|