explode digits in batch possible? -


i trying make batch ip adres , remotly start commandline @ ip adress. user need put in 4 digit server nr. 4502 batch needs ip of server -> xxx.x45.x02.xxx

this got far :

@echo off set versie= versie-1.0  :menu1 title tool - menu cls echo. echo #################################### echo # 1. command  starten              # echo #################################### echo # 9. quit                          # echo #################################### echo ##          %versie%          ##  echo.  set input= set /p input=make choise:   if "%input%" =="1" goto cmd_1 if "%input%" =="9" goto quit  :cmd_1 title tool - command cls set /p fourdigits=give 4 digits call :getip %fourdigits% goto menu1  :getip if "%1"=="" :startcommand echo %1  shift goto :getip  :startcommand psexec -i \\xxx.x%getip1%%getip2%.x%getip3%%getip4%.xxx  -u username -p     password /accepteula cmd goto menu1  :quit exit 

i'm rather new @ language , hope can me whit this. (also hope i'm little bit understandable whit want do:)) helpfull pointers i'm doing wrong :)

thanks in advanced.

set /? shows you, how extract substrings variable (the uses %path% example, works every variable)

set fourdigits=4502 set firsttwo=%fourdigits:~0,2% set secondtwo=%fourdigits:~2,2% set lasttwo=%fourdigits:~-2%  echo psexec -i \\xxx.x%firsttwo%.x%lasttwo%.xxx -u username -p password /accepteula cmd 

(secondtwo , lasttwo redundant; need 1 of them. wanted show different options.)


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -