SHARE
TWEET

Create new ramdisk with Imdisk

starbeamrainbowlabs Aug 12th, 2015 309 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2.  
  3. :: BatchGotAdmin7
  4. :: From http://stackoverflow.com/a/10052222/1460422
  5. :-------------------------------------
  6. REM  --> Check for permissions
  7. >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
  8.  
  9. REM --> If error flag set, we do not have admin.
  10. if '%errorlevel%' NEQ '0' (
  11.     echo Requesting administrative privileges...
  12.     goto UACPrompt
  13. ) else ( goto gotAdmin )
  14.  
  15. :UACPrompt
  16.     echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
  17.     set params = %*:"=""
  18.     echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
  19.  
  20.     "%temp%\getadmin.vbs"
  21.     del "%temp%\getadmin.vbs"
  22.     exit /B
  23.  
  24. :gotAdmin
  25.     pushd "%CD%"
  26.     CD /D "%~dp0"
  27. :--------------------------------------
  28.  
  29.  
  30. echo Ramdisk creation script
  31.  
  32. title Ramdisk Creation
  33.  
  34. set /p drive_letter=Enter Drive Letter:
  35.  
  36. if "%drive_letter%"=="" ( set drive_letter=R )
  37.  
  38. if exist %drive_letter%: (
  39.         echo A disk already exists with the letter %drive_letter%:.
  40.         echo Please unmount it before using this script.
  41. )
  42.  
  43. set /p size=Enter Size:
  44.  
  45. imdisk -a -s %size% -m %drive_letter%: -p "/fs:fat32 /q /y"
  46.  
  47. pause
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top