Windows では, コマンドプロンプトを管理者として開き, 次のコマンドを実行することにより, 7-Zip 23.01 のインストールを行うことができる.
mkdir %HOMEPATH%\7zip cd %HOMEPATH%\7zip curl -O https://www.7-zip.org/a/7z2301-x64.exe .\7z2301-x64.exe powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\Program Files\7-Zip\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
コマンドプロンプトを管理者として実行: 別ページ »で説明
mkdir c:\mingw64 cd c:\mingw64 curl -L -O https://github.com/niXman/mingw-builds-binaries/releases/download/13.1.0-rt_v11-rev1/x86_64-13.1.0-release-win32-seh-ucrt-rt_v11-rev1.7z cd c:\ "c:\Program Files\7-Zip\7z" x c:\mingw64\x86_64-13.1.0-release-win32-seh-ucrt-rt_v11-rev1.7z
MINGW64
次のコマンドを実行
powershell -command "[System.Environment]::SetEnvironmentVariable(\"MSYSTEM\", \"MINGW64\", \"Machine\")"
次のコマンドを実行
powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\mingw64\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")" powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\mingw64\opt\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
そのために,新しく Windows のコマンドプロンプトを開き、次のコマンドを実行する.
エラーメッセージが出なければOK.
where gcc where g++ where gfortran where gdb
ここではメモ帳 (notepad) を使っている.
Windows のコマンドプロンプトを開く. そして,次のように実行して,プログラムファイルを作る. そのファイル名は hello.c としている.
c: cd %HOMEPATH% notepad hello.c
#include<stdio.h> int main() { printf("Hello,World!\n"); printf("sizeof(size_t)=%ld\n", sizeof(size_t)); return 0; }
Windows のコマンドプロンプトを開き、次を実行.
結果として,「Hello,World!」「sizeof(size_t)=8」と表示されればOK.
del a.exe gcc hello.c .\a.exe
ここではメモ帳 (notepad) を使っている.
Windows のコマンドプロンプトを開き,次のコマンドを実行する..png ファイル名は hello.f90 としている.
c: cd %HOMEPATH% notepad hello.f90
program main print *, 'Hello,World!' stop end program main
結果として,「Hello,World!」と表示されればOK.
del hello.exe gfortran hello.f90 -o hello.exe .\hello.exe
実行結果例