Bienvenidos a Abandonsocios: El Portal de los Juegos Antiguos
0 Usuarios y 1 Visitante están viendo este tema.
@echo offECHO Copiando Archivo.ini . . .COPY "Archivo.ini" "%PROGRAMFILES% (x86)\ProgramaEjemplo\Archivo.ini"ECHO.ECHO Archivo.ini copiado con exitopauseEXIT
COPY "%USERPROFILE%\Documents\Prueba.ini" "%PROGRAMFILES% (x86)\Prueba\Prueba.ini"
COPY ".\Prueba.ini" "%PROGRAMFILES% (x86)\Prueba\Prueba.ini"
@echo offECHO Copiando Archivo.ini .SET mypath=%~dp0COPY "%mypath%archivo.ini" "%PROGRAMFILES(x86)%\ProgramaEjemplo\Archivo.ini"ECHO.ECHO Archivo.ini copiado con exitopauseEXIT
::::::::::::::::::::::::::::::::::::::::::::::::::::::: Automatically check & get admin rights V2 :::::::::::::::::::::::::::::::::::::::::::::::::::::::@echo offCLSECHO.ECHO =============================ECHO Running Admin shellECHO =============================:initsetlocal DisableDelayedExpansionset "batchPath=%~0"for %%k in (%0) do set batchName=%%~nkset "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"setlocal EnableDelayedExpansion:checkPrivilegesNET FILE 1>NUL 2>NULif '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ):getPrivilegesif '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)ECHO.ECHO **************************************ECHO Invoking UAC for Privilege EscalationECHO **************************************ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"ECHO args = "ELEV " >> "%vbsGetPrivileges%"ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"ECHO Next >> "%vbsGetPrivileges%"ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%""%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*exit /B:gotPrivilegessetlocal & pushd .cd /d %~dp0if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)::::::::::::::::::::::::::::::START::::::::::::::::::::::::::::REM Run shell as admin (example) - put here code as you likeECHO Copiando Archivo.ini .SET mypath=%~dp0COPY "%mypath%archivo.ini" "%PROGRAMFILES(x86)%\ProgramaEjemplo\Archivo.ini"ECHO.ECHO Archivo.ini copiado con exitopauseEXITcmd /k