Skip to content

Instantly share code, notes, and snippets.

@susilolab
Last active July 4, 2023 01:23
Show Gist options
  • Save susilolab/7ed8f961bc20ea953c25fb1a39f61bcc to your computer and use it in GitHub Desktop.
Save susilolab/7ed8f961bc20ea953c25fb1a39f61bcc to your computer and use it in GitHub Desktop.
Setting cl compiler powershell windows 10
function Invoke-CmdScript {
  param(
    [String] $scriptName
  )
  $cmdLine = """$scriptName"" $args & set"
  & $env:SystemRoot\system32\cmd.exe /c $cmdLine |
  Select-String '^([^=]*)=(.*)$' | ForEach-Object {
    $varName = $_.Matches[0].Groups[1].Value
    $varValue = $_.Matches[0].Groups[2].Value
    Set-Item Env:$varName $varValue
  }
}

Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment