need to get desired data from string using batch

前端 未结 2 572
终归单人心
终归单人心 2021-01-26 20:00

i need to extract only URL and app id in the given string and saved in variables

url:{ \"url\":\"ad.ifwcash.com/www/delivery/afr.php?zoneid=127&cb=201

2条回答
  •  甜味超标
    2021-01-26 20:10

    this works if there's an url.txt file in same directory with content: {"url":{ "url":"ad.ifwcash.com/www/delivery/afr.php?zoneid=127&cb=2015738640", "app":61}} Eventually you'll need to change name/location of the file on the third line (save the file bellow with .bat extension):

    @echo off
    
    setlocal enableDelayedExpansion
    
    set "jsonFile=.\url.txt"
    set counter=1
    
    
    
    for /f %%# in ('echo %jsonFile%^|mshta.exe "%~f0"') do (
      set "variable_!counter!=%%#"
      set /a counter=counter+1
    )
    
    set variable_
    
    echo #############################
    echo ###  more batch code here ###
    echo #############################
    
    
    exit /b
    
    
    
    
    

提交回复
热议问题