Si no encuentra un archivo addbat confiable, considere estas herramientas superiores que hacen lo mismo pero con interfaz gráfica o mayor control:
| Herramienta | Tipo | Ventaja sobre archivo batch | |-------------|------|------------------------------| | PowerShell | Script avanzado | Sintaxis más segura, depuración integrada | | AutoHotkey | Automatización | Ejecuta acciones sin ventanas CMD visibles | | Task Scheduler | Programador nativo | Ejecuta lotes con privilegios específicos | | BatchCompile | Conversor a EXE | Oculta código fuente y evita modificaciones accidentales |
Si lo que buscas es "addbat" específicamente para agregar comandos al PATH de Windows, crea tu propio script:
@echo off
title AddToPath - Script Top
setx PATH "%PATH%;C:\MisScriptsBatch"
echo Carpeta C:\MisScriptsBatch añadida al PATH del sistema.
pause
@echo off
setlocal enabledelayedexpansion
rem Configuración
set "DEST_DIR=%USERPROFILE%\Tools\Batch"
set "SHORTCUT_DIR=%USERPROFILE%\Desktop"
set "SAMPLE_BAT=hola.bat"
set "SAMPLE_URL="
rem Crear directorio destino si no existe
if not exist "%DEST_DIR%" (
mkdir "%DEST_DIR%"
echo Creado: %DEST_DIR%
) else (
echo Existe: %DEST_DIR%
)
rem Si hay URL, intentar descargar (usa bitsadmin o powershell)
if defined SAMPLE_URL (
echo Descargando %SAMPLE_URL%...
powershell -Command "Invoke-WebRequest -Uri '%SAMPLE_URL%' -OutFile '%DEST_DIR%\%SAMPLE_BAT%'"
) else (
rem Crear ejemplo de script si no se proporciona fuente
echo @echo off > "%DEST_DIR%\%SAMPLE_BAT%"
echo echo Hola, este es un script de ejemplo. >> "%DEST_DIR%\%SAMPLE_BAT%"
echo pause >> "%DEST_DIR%\%SAMPLE_BAT%"
echo Creado ejemplo: %DEST_DIR%\%SAMPLE_BAT%
)
rem Crear acceso directo en el Escritorio (usando PowerShell)
set "TARGET=%DEST_DIR%\%SAMPLE_BAT%"
set "LINK=%SHORTCUT_DIR%\Addbat - %SAMPLE_BAT%.lnk"
powershell -Command "$s=(New-Object -COM WScript.Shell).CreateShortcut('%LINK%'); $s.TargetPath='%SystemRoot%\system32\cmd.exe'; $s.Arguments='/c \"\"%TARGET%\"\"'; $s.WorkingDirectory='%DEST_DIR%'; $s.Save()"
echo Acceso directo creado: %LINK%
rem Añadir al PATH de usuario (opcional)
set "ADD_PATH=%DEST_DIR%"
for /f "tokens=2* delims= " %%A in ('reg query "HKCU\Environment" /v PATH 2^>nul ^| find "PATH"') do set "CURPATH=%%B"
echo %CURPATH% | find /I "%ADD_PATH%" >nul
if errorlevel 1 (
echo Agregando %ADD_PATH% al PATH de usuario...
setx PATH "%CURPATH%;%ADD_PATH%" >nul
echo PATH actualizado. Cierra sesión y vuelve a iniciar para ver cambios.
) else (
echo %ADD_PATH% ya está en PATH.
)
echo Hecho.
endlocal
@echo off title Add Folder to PATH setlocal enabledelayedexpansion:: Check if run as administrator net session >nul 2>&1 if %errorlevel% neq 0 ( echo [!] This batch file requires Administrator privileges. echo Right-click and select "Run as administrator". pause exit /b 1 ) descargar archivo batch addbat para windows top
:: Get folder path from user echo Enter the full folder path to add to system PATH: set /p "folder=> "
:: Remove quotes if user added them set "folder=%folder:"=%"
:: Validate folder exists if not exist "%folder%" ( echo [!] Error: Folder does not exist. pause exit /b 1 ) Si no encuentra un archivo addbat confiable, considere
:: Get current system PATH (remove temporary variables) for /f "skip=2 tokens=1-2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH') do ( set "currentPath=%%c" )
:: Check if folder already in PATH echo !currentPath! | find /i "!folder!" >nul if not errorlevel 1 ( echo [*] Folder already exists in PATH. pause exit /b 0 )
:: Add new path set "newPath=!currentPath!;!folder!" reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH /t REG_EXPAND_SZ /d "!newPath!" /f @echo off title Add Folder to PATH setlocal
:: Notify user echo [✓] Added !folder! to system PATH. echo [!] You must restart Command Prompt or the system for changes to apply.
pause