从注册表项值数据获取安装位置

时间:2019-05-31 03:07:34

标签: batch-file registry

我基本上想知道是否有可能从注册表中获取路径并将其用于批处理文件中。

基本上,我所拥有的是从该网站收集的一些代码

@echo off
reg query "HKLM\SOFTWARE\Wow6432Node\Rockstar Games\Grand Theft Auto V" /v     "InstallFolder"

该行返回

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Rockstar Games\Grand Theft Auto V
InstallFolder    REG_SZ    D:\Rockstar Games\Grand Theft Auto V

我在这里要做的就是将GTA的路径添加到批处理文件中,这样我就可以通过批处理文件启动可执行文件(PlayGTAV.exe)。我不使用我已经知道的路径的原因是因为我也希望该批处理文件也可以在某些朋友计算机上工作。

1 个答案:

答案 0 :(得分:0)

this.props.navigation.push('SecondScreen')

这应该演示如何-我显然使用了其他密钥。

MYDIR=$(dirname $(readlink -f ${BASH_SOURCE[0]})) SAVEDIR=$(pwd) # Check programs if [ -z "$(which ffmpeg)" ]; then echo "Error: ffmpeg is not installed" exit 1 fi if [ -z "$(which MP4Box)" ]; then echo "Error: MP4Box is not installed" exit 1 fi cd "$MYDIR" TARGET_FILES=$(find ./ -maxdepth 1 -type f \( -name "*.mov" -or -name "*.mp4" \)) for f in $TARGET_FILES do fe=$(basename "$f") # fullname of the file f="${fe%.*}" # name without extension if [ ! -d "${f}" ]; then #if directory does not exist, convert echo "Converting \"$f\" to multi-bitrate video in MPEG-DASH" mkdir "${f}" ffmpeg -y -i "${fe}" -c:a aac -b:a 192k -vn "${f}_audio.m4a" ffmpeg -y -i "${fe}" -preset slow -tune film -vsync passthrough -write_tmcd 0 -an -c:v libx264 -x264opts 'keyint=25:min-keyint=25:no-scenecut' -crf 23 -maxrate 800k -bufsize 2000k -pix_fmt yuv420p -vf "scale=-2:720" -f mp4 "${f}_800.mp4" # static file for ios and old browsers and mobile safari ffmpeg -y -i "${fe}" -preset slow -tune film -movflags +faststart -vsync passthrough -write_tmcd 0 -c:a aac -b:a 160k -c:v libx264 -crf 23 -maxrate 1400 -bufsize 3000k -pix_fmt yuv420p -f mp4 "${f}/${f}.mp4" rm -f ffmpeg*log* # if audio stream does not exist, ignore it if [ -e "${f}_audio.m4a" ]; then MP4Box -dash-strict 2000 -rap -frag-rap -bs-switching no -profile "dashavc264:live" "${f}_5000.mp4" "${f}_3000.mp4" "${f}_1500.mp4" "${f}_800.mp4" "${f}_400.mp4" "${f}_audio.m4a" -out "${f}/${f}.mpd" rm "${f}_5000.mp4" "${f}_3000.mp4" "${f}_1500.mp4" "${f}_800.mp4" "${f}_400.mp4" "${f}_audio.m4a" else MP4Box -dash-strict 2000 -rap -frag-rap -bs-switching no -profile "dashavc264:live" "${f}_5000.mp4" "${f}_3000.mp4" "${f}_1500.mp4" "${f}_800.mp4" "${f}_400.mp4" -out "${f}/${f}.mpd" rm "${f}_5000.mp4" "${f}_3000.mp4" "${f}_1500.mp4" "${f}_800.mp4" "${f}_400.mp4" fi # create a jpg for poster. Use imagemagick or just save the frame directly from ffmpeg is you don't have cjpeg installed. ffmpeg -i "${fe}" -ss 00:00:00 -vframes 1 -qscale:v 10 -n -f image2 - | cjpeg -progressive -quality 75 -outfile "${f}"/"${f}".jpg fi done cd "$SAVEDIR" 找到包含@ECHO OFF SETLOCAL FOR /f "delims=" %%a IN ('reg query "HKLM\SOFTWARE\Embarcadero\Interbase\Servers" ^|find " REG_SZ "') DO ( SET "target=%%a" ) SET "target=%target:*REG_SZ =%" ECHO "%target%" GOTO :EOF 的相应行(插入符号用于告诉^|find...管道是REG_SZ命令的一部分,而不是{ {1}}和cmd选择整行申请reg query

从那里开始,只需将子字符串应用于普通环境变量for(因为不允许元变量for /f "delims="的子字符串)-替换{ {1}}不带 %%a和终端target

之间的字符串