Win7- 在startup去設定HOMEDRIVE,HOMEPATH , HOME等去設定環境變數

引用自superuser, 一個範例去設定系統的環境變數在windows7或winXP上!

  1. If you are on Windows 7, you can skip this step. If you are on Windows XP, download and installWindows XP Service Pack 2 Support Tools which contains SETX, a utility, described on SS64and technet, that lets you set permanent system and user variables. You must have administrative rights to set global system variables. The basic usage is SETX <variable> "<value>" [-m].
  2. Add the following script to your startup folder – W7: "C:\Users\<username>\Start Menu\Programs\Startup" and XP: "C:\Documents and Settings\<username>\Start Menu\Programs\Startup".
    SETX HOMEDRIVE %SYSTEMDRIVE% -m
    SETX HOMEPATH "\Documents and Settings\%USERNAME%" -m
    SETX HOMESHARE "\\<server>\<share>" -m
    SET HOME=%SYSTEMDRIVE%\Documents and Settings\%USERNAME%
    SETX HOME "%HOME%"
    SET TEMP=%HOME%\Local Settings\Temp
    SETX TEMP "%TEMP%"
    SETX TMP "%TEMP%"
    

Note: SETX variables are permanent, but are not available until after the script runs, so use SET to create temporary variables in your script. Also uses double quotes around the value you want to set your variable to in case it has spaces, but this is not necessary for SET. Machine variables are set with the -m option; user variable is the default. Windows 7 has many more options and uses /instead of -.

%systemdrive%是什麼東東啊?

引用自: pczone
Q: 所謂:本機硬碟的 %systemdrive%\Sysprep 資料夾中, 本機硬碟應是指c:吧, 而我不明白的是,%systemdrive%是什麼東東啊?且要把它建立在 C 的哪個目錄下才行呢?請各位前輩教教我,謝謝!!
A: 這意思應是在必須在 C:\ 下建立一個名為Sysprep 的資料夾吧…….預設的 %Systemdrive% 指的是 C:,進入 DOS 模式,使用 Set 指令,即可看到類似
Systemdrive=c:
Systemroot=c:\winnt
……..

發表迴響