Skip to content

Instantly share code, notes, and snippets.

@GGG-KILLER
Last active January 30, 2016 06:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GGG-KILLER/2851d305302945f69530 to your computer and use it in GitHub Desktop.
Save GGG-KILLER/2851d305302945f69530 to your computer and use it in GitHub Desktop.
Batch to make Atom portable
@echo off
:: Get current drive's letter.
set a=%~dp0
echo Base path: %a%
:: Filesystem checking.
if not exist "%a%\Atom" (
echo [ERROR]Atom folder not found.
goto error
)
if not exist "%a%\Atom\atom.exe" (
echo [ERROR]Atom executable not found.
goto error
)
:: Environment vars setting
set ATOM_HOME=%a%\Atom\data
set USERPROFILE=%ATOM_HOME%
set APPDATA=%USERPROFILE%\AppData
echo ATOM_HOME: %ATOM_HOME%
echo USERPROFILE: %USERPROFILE%
echo APPDATA: %APPDATA%
if not exist "%ATOM_HOME%" mkdir "%ATOM_HOME%"
if not exist "%USERPROFILE%\AppData" mkdir "%USERPROFILE%\AppData"
if not exist "%USERPROFILE%\AppData\Roaming" mkdir "%USERPROFILE%\AppData\Roaming"
if not exist "%USERPROFILE%\Desktop" mkdir "%USERPROFILE%\Desktop"
:: Go to atom's folder and launch it.
:launch
cd Atom
start "" atom.exe
goto exit
:error
echo [ERROR]Atom folder MUST be in %a%, named Atom and atom's executable MUST be named atom.exe
set /p m=Press any key to leave...
goto exit
:exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment