As a developer, what changes do you make to a vanilla Windows install?

前端 未结 30 1835
没有蜡笔的小新
没有蜡笔的小新 2021-01-29 17:13

When I get a vanilla Windows system, there\'s a bunch of stuff I change to make it more developer-friendly.

Some of it I remember every time, other stuff I only do as an

30条回答
  •  南方客
    南方客 (楼主)
    2021-01-29 17:57

    Command line scripts

    For storing scripts that I use from the command line I create a Command Line Scripts directory under Program Files and add it to the PATH environment variable. I use the following batch file for listing and editing those scripts:

    @echo off
    setlocal
    
    set UTILPATH=C:\Program Files\System Tools\Command Line Utilities
    
    if not "x%1"=="x" (
    
    start "" "notepad" "%UTILPATH%\%1.bat"
    
    ) else (
    
    dir /b "%UTILPATH%" | grep -v com.bat | grep -P "(exe|bat|cmd)" | sed "s/\.\(exe\|bat\|cmd\)//"
    echo.
    
    )
    

    (note that the filtering of the directory listing depends on some unix commands I have installed via Cygwin)

    I give it the name com.bat, (short for command) then I can:

    • list the scripts in that directory by typing com at the command prompt
    • edit any script in the list by typing com script-name at the command prompt*, similarly:
    • create new scripts in that directory by typeing com new-script-name at the command prompt*
    • and if I ever need to edit com.bat I just type com com

    * As I'm running Vista I have to use an elevated command prompt as directories under Program Files are protected. For a quick way to launch an elevated command prompt, simply press the Win key; type cmd; press Ctrl+Shift+Enter; and then hit Alt+C to confirm the elevation prompt. Six keystrokes to an elevated command prompt! ([via][4])

    Startup Script

    One of the scripts I store in my Command Line Scripts directory is a script that is run when I log in to windows (via the Task Scheduler, type Task in the Vista start menu). I use that script to set up several virtual drives using the subst command to directories I access frequently or want a quick way to access on the command prompt or for shortening path names in compiler warnings, logs or debug output.

    My Startup script looks something like this:

    @setlocal
    @set _MYDOCS_=%USERPROFILE%\Documents
    
    @REM Note: first delete the drives so I can run script again
    @REM       to fix drives that failed to get mapped
    
    subst /d W:
    subst /d T:
    subst /d S:
    subst /d R:
    subst /d N:
    subst /d L:
    subst /d H:
    subst W: "%_MYDOCS_%\Work\SVN Working Copy\Website\trunk\www"
    subst T: "%_MYDOCS_%\Work\SVN Working Copy\project 1\trunk"
    subst S: "%_MYDOCS_%\Work\SVN Working Copy"
    subst R: "%_MYDOCS_%\Work\SVN Working Copy\project 2\branches\12.50"
    subst N: "%_MYDOCS_%\Work\SVN Working Copy\project 2\trunk"
    subst L: "%_MYDOCS_%\Work\"
    subst H: "%_MYDOCS_%\My Projects\Haslers.info\Working Copy"
    

    Note that subst can be a little temperamental and occasionally the drives don't get created and I have to run the startup script again manually.

提交回复
热议问题