在 Linux 和 OS X 上,我习惯于通过这样做在指定的 Rails环境"中运行 Rake 任务:
On Linux and OS X, I'm accustomed to running Rake tasks in specified Rails "environments" by doing this:
$ export RAILS_ENV=monster_island ; rake monsters:destroy_all如果我在 Windows XP 上的 Windows 控制台中运行任务,我如何执行等效操作?
How can I do the equivalent if I'm running the task on Windows XP in a Windows console?
推荐答案c:>set RAILS_ENV=monster_island
c:>set RAILS_ENV=monster_island
如果不带任何其他参数运行 set,您将看到设置的环境变量.在控制台中运行 set 将仅为该控制台设置该变量,并且不会跨会话或其他控制台持久存在.
If you run set without any other arguments, you will see the environment variables that are set. Running set in a console will set that variable for just that console and won't be persisted across sessions or to other consoles.
您也可以在控制面板中永久设置 - 打开系统,选择高级,然后选择环境变量(这可能会因您的 Windows 版本而略有不同).
You can also set it permanently in the Control Panel - open System, select Advanced, and then Environment Variables (this may vary slightly depending on your version of Windows).
更多推荐
如何在 Windows 控制台中设置 RAILS
发布评论