Last active
July 20, 2022 18:49
-
-
Save vicenteherrera/7e9bd9d06fdb7acfc3ad23e8805f9aa9 to your computer and use it in GitHub Desktop.
Mount hard drive ext4 partition on WSL2 Linux on Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@setlocal disabledelayedexpansion enableextensions | |
@echo off | |
:: Admin check | |
fltmc >nul 2>nul || set _=^"set _ELEV=1^& cd /d """%cd%"""^& "%~f0" %* ^"&&((if "%_ELEV%"=="" (echo Requesting administrator privileges...&((powershell -nop -c start cmd -args '/d/x/s/v:off/r',$env:_ -verb runas >nul 2>nul) || (mshta vbscript:execute^("createobject(""shell.application"").shellexecute(""cmd"",""/d/x/s/v:off/r ""&createobject(""WScript.Shell"").Environment(""PROCESS"")(""_""),,""runas"",1)(window.close)"^) >nul 2>nul))) else (echo This script requires administrator privileges.& pause))& exit /b) | |
echo Has admin permissions | |
:: echo Working dir: "%cd%" | |
:: echo Script dir: "%~dp0" | |
:: echo Script path: "%~f0" | |
:: echo Args: %* | |
echo Mounting drive 2 partition 4 format ext4 | |
wsl --mount \\.\PHYSICALDRIVE2 --partition 4 --type ext4 | |
:: | |
:: wsl --unmount \\.\PHYSICALDRIVE2 | |
::pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment