ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 배치파일 비트/부팅/GUID
    컴퓨터/배치파일 2016. 4. 10. 15:01

    1. csm/efi 구분

    bcdedit /enum {current} | find "winload.efi" && (bcdedit  /set %guid% path \windows\system32\winload.efi)

    bcdedit /enum {current} | find "winload.efi" || (bcdedit  /set %guid% path \windows\system32\winload.exe)

    or

    set bios=exe

    bcdedit /enum bootmgr | findstr bootmgfw.efi

    if not errorlevel 1 set bios=efi

    bcdedit /set !guid! path \windows\system32\winload.!bios!



    2. guid 

    for /f "tokens=1-5 usebackq delims=-" %%a in (`bcdedit /create /d "Setup Windows 10" /application osloader`) do (            set first=%%a

                set last=%%e

                set guid=!first:~-9!-%%b-%%c-%%d-!last:~0,13!

            )

    or

    for /f "tokens=1 delims={}" %%g in ('%BCDEDIT% /store %BCDSTORE% /create /application osloader') do set GUID={%%g}


    3. 32/64구분

    :CheckOS

    IF EXIST "%PROGRAMFILES(X86)%" (set bit=x64) ELSE (set bit=x86)

    or

    :CheckOS

    IF "%PROCESSOR_ARCHITECTURE%"=="x86" (set bit=x86) else (set bit=x64)

    or

    rem --> check processor architecture

    if /i "%PROCESSOR_ARCHITECTURE%"=="x86" set "batch_cpu=x86"

    if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" set "batch_cpu=x64"

    if /i "%PROCESSOR_ARCHITECTURE%"=="IA64" set "batch_cpu=x64"


    ::32/64Bit Switch

    ECHO %PROCESSOR_ARCHITECTURE%|FINDSTR AMD64>NUL && SET ARCH=AMD64 || SET ARCH=x86

    ECHO %ARCH%


    SYSTEM VARIABLES

    --------------------------------------------------------------------------------


    SYSTEM:

    %systemdrive%             > C:

    %windir%                  > C:\Windows

    %systemroot%              > C:\Windows

    %programfiles%            > C:\Program Files

    %programfiles(x86)%       > C:\Program Files (x86)

    %commonprogramfiles%      > C:\Program Files\Common Files

    %commonprogramfiles(x86)% > C:\Program Files (x86)\Common Files

    %programdata%             > C:\ProgramData

    %allusersprofile%         > C:\ProgramData

    USER:

    %userprofile%             > C:\Users\s1ave77

    %appdata%                 > C:\Users\s1ave77\AppData\Roaming

    %localappdata%            > C:\Users\s1ave77\AppData\Local

    %public%                  > C:\Users\Public


    --------------------------------------------------------------------------------

    :: ------------EXTRA CODE TO CHANGE DIRECTORY-------------

    echo %~n0%~x0 started from Directory: %~d0%~p0

    %~d0

    cd %~d0%~p0

    :: -------------------------------------------------------

    댓글

Designed by Tistory.