title: HOMEPATH not set when Jenkins service as as standard user
body: <p>This is on Windows 2012 R2 Server and Jenkins 1.609:</p>
  
  <p>I'm running Jenkins as a service, configured to log on as a standard user.  I'm noticing that the environment variables do not contain HOMEDRIVE or HOMEPATH.</p>
  
  <p>When I do 'set' in a build step, I get this output:</p>
  
  <pre><code>Started by user anonymous
  Building in workspace E:\jenkins\test\workspace
  [workspace] $ cmd /c call C:\Users\jenkins\AppData\Local\Temp\hudson5767169902901377197.bat
  
  E:\jenkins\test\workspace&gt;set
  ALLUSERSPROFILE=C:\ProgramData
  APPDATA=C:\Users\jenkins\AppData\Roaming
  BASE=C:\Program Files (x86)\Jenkins
  BPADir=C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools\Best Practices Analyzer\
  BUILD_DISPLAY_NAME=#7
  BUILD_ID=7
  BUILD_NUMBER=7
  BUILD_TAG=jenkins-test-7
  BUILD_URL=http://localhost:8080/job/test/7/
  CommonProgramFiles=C:\Program Files (x86)\Common Files
  CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
  CommonProgramW6432=C:\Program Files\Common Files
  COMPUTERNAME=ARION
  ComSpec=C:\Windows\system32\cmd.exe
  DEVMGR_SHOW_NONPRESENT_DEVICES=1
  DXSDK_DIR=C:\Program Files (x86)\Microsoft DirectX SDK (August 2006)\
  EXECUTOR_NUMBER=0
  FP_NO_HOST_CHECK=NO
  HUDSON_COOKIE=9752005b-45d1-4655-b8c5-4fa37aeedbbc
  HUDSON_HOME=C:\Program Files (x86)\Jenkins
  HUDSON_SERVER_COOKIE=422669ffa5970bd3
  HUDSON_URL=http://localhost:8080/
  JENKINS_HOME=C:\Program Files (x86)\Jenkins
  JENKINS_SERVER_COOKIE=422669ffa5970bd3
  JENKINS_URL=http://localhost:8080/
  JOB_NAME=test
  JOB_URL=http://localhost:8080/job/test/
  LOCALAPPDATA=C:\Users\jenkins\AppData\Local
  NODE_LABELS=master
  NODE_NAME=master
  NUMBER_OF_PROCESSORS=4
  OS=Windows_NT
  Path=C:\Program Files (x86)\Microsoft DirectX SDK (August 2006)\Utilities\Bin\x86;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Python33\;C:\Perl\site\bin;C:\Perl\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Igence\nims;C:\Program Files (x86)\Aspell\bin;'C:\Program Files\Adobe\Adobe PDF iFilter 11 for 64-bit platforms\bin\;C:\MinGW\bin;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\CMake 2.8\bin;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools\;C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools\Best Practices Analyzer\;C:\Program Files (x86)\Igence\nims;%HOMEDRIVE%%HOMEPATH%\bin;C:\Program Files (x86)\git\bin
  PATHEXT=.PY;.SCM;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
  PROCESSOR_ARCHITECTURE=x86
  PROCESSOR_ARCHITEW6432=AMD64
  PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 15 Stepping 6, GenuineIntel
  PROCESSOR_LEVEL=6
  PROCESSOR_REVISION=0f06
  ProgramData=C:\ProgramData
  ProgramFiles=C:\Program Files (x86)
  ProgramFiles(x86)=C:\Program Files (x86)
  ProgramW6432=C:\Program Files
  PROMPT=$P$G
  PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\
  PUBLIC=C:\Users\Public
  SERVICE_ID=jenkins
  SystemDrive=C:
  SystemRoot=C:\Windows
  TEMP=C:\Users\jenkins\AppData\Local\Temp
  TFSPowerToolDir=C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools\
  TMP=C:\Users\jenkins\AppData\Local\Temp
  USERDOMAIN=ARION
  USERNAME=jenkins
  USERPROFILE=C:\Users\jenkins
  VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
  VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
  VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
  VS80COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools\
  windir=C:\Windows
  windows_tracing_flags=3
  windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log
  WINSW_EXECUTABLE=C:\Program Files (x86)\Jenkins\jenkins.exe
  WORKSPACE=E:\jenkins\test\workspace
  </code></pre>
  
  <p>Is this a consequence of running as a standard user? I thought that would be good practice, since I can then lock down that user?</p>
  
  <p>Actually, my real problem is that I'm then trying to start a git-bash shell and it's not setting HOME properly; hence can't find things like ~/.gitconfig, but I think not having HOMEDRIVE and HOMEPATH set is the reason why git-bash shell isn't working.</p>
  
  <p>Thanks for any help.</p>
  
  <p>UPDATE: If I explicitly set HOMEDRIVE and HOMEPATH, I can prove that git-bash now sees a valid $HOME, and paths like ~/.gitconfig work. So why is Windows not setting them in the first place?</p>