Benutzer:MovGP0/Powershell
aus Wikipedia, der freien Enzyklopädie
< Benutzer:MovGP0
Dies ist die aktuelle Version dieser Seite, zuletzt bearbeitet am 11. August 2016 um 07:30 Uhr durch imported>MovGP0(77247) (→Umgebungsvariablen).
MovGP0 | Über mich | Hilfen | Artikel | Weblinks | Literatur | Zitate | Notizen | Programmierung | MSCert | Physik |
PowershellUmgebungsvariablen
# 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
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
Text UI Libraries
|