The script uses vswhere.exe to determine the Visual Studio root installation directory and then invokes VsDevCmd.bat in that directory.
The script currently allows to take the optional argument 64 which will set up an environment to produce 64-bit AMD applications (by setting the -arch= argument of VsDevCmd.bat to amd64).
C:\> vsenv
C:\> vsenv 64
@echo off
rem
rem Uncomment setting VSCMD_DEBUG to enable debugging to output
rem
rem set VSCMD_DEBUG=3
rem
rem Determine path to VsDevCmd.bat
rem
for /f "usebackq delims=#" %%a in (`"%programfiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -latest -property installationPath`) do set VsDevCmd_Path=%%a\Common7\Tools\VsDevCmd.bat
if [%1] equ [64] (
"%VsDevCmd_Path%" -arch=amd64
) else (
"%VsDevCmd_Path%"
)
rem set VSCMD_DEBUG=
set VsDevCmd_Path=