I'm trying to setup my developer environment in Windows (I know.. I know..). Cmder uses PowerShell and makes this quite a bit more comfortable. Virtualenv however still is a bit cumbersome, virtualenvwrapper supposedly makes it a bit more easier.
However, virtualenvwrapper is using the activate.bat in its workon.bat command, which has some problems with PowerShell. Since virtualenv supports Powershell out of the box since 1.7.1 (2012-02-16) and offers its own activate.ps1 script that works fine, I would like to use that instead.
The relevant part in workon.bat:
if not exist "%WORKON_HOME%\%VENV%\Scripts\activate.bat" (
echo.
echo. %WORKON_HOME%\%VENV%
echo. doesn't contain a virtualenv ^(yet^).
echo. Create it with "mkvirtualenv %VENV%"
goto END
)
call "%WORKON_HOME%\%VENV%\Scripts\activate.bat"
if defined WORKON_OLDTITLE (
title %1 ^(VirtualEnv^)
)
Simply replacing activate.bat with activate.ps1 doesn't work (opens a new shell or my editor depending on the set default program) and I've never did anything in batch, which is why I'm stuck.
Basically, all you need is
assuming that
activate.ps1is in the same folder asactivate.bat. The other batch commands are just for displaying some help text ifactivate.batdoesn't exist, and for changing the window title. If you want the latter in PowerShell too, you can do it like this: