📜 ⬆️ ⬇️

Bat-file illustrating the work with the registry, UNC paths and strings

If there is no compiler at hand, then in windows surrounded batch file is quite a handy tool. The following example illustrates working with the registry from a batch file, how to implement a batch file from a network resource, as well as some simple string operations using the example of copying and launching a crack for the STALKER game, the path to which is pulled out of the registry (listing under the program).

It would be interesting to look at a more elegant solution to this problem.

@cls
@echo off

echo ********************************************************
echo *****************STALKER**no-cd******************
echo ********************************************************

rem REG QUERY,
rem ,
rem , . 1 .

for /f "skip=4 tokens=3*" %%i in ('REG QUERY "HKLM\SOFTWARE\GSC Game World\STALKER-SHOC" /v InstallPath') do (

rem . ( )
rem

rem ! %~dp0
rem xcopy
rem , %%i:~0,-1%%
rem , xcopy

IF "%%j" == "" (
xcopy "%~dp0crack.exe" "%%i:~0,-1%%"
) ELSE (
xcopy "%~dp0crack.exe" "%%i %%j:~0,-1%%"
)

rem
cd /d "%%i %%j" || exit 1
rem
crack.exe
pause
exit
)

PS Utility reg.exe in win2k is not by default, in winxp - there is :)

')

Source: https://habr.com/ru/post/20755/


All Articles