Tech Support Guy banner

Solved: Batch file to fix VPN Help

925 Views 2 Replies 2 Participants Last post by  vdsag
Hello Guys,

I am new creating batch files and im trying to create a batch file that fixes my PC routing table while conecting to VPN, here is the details:


I got stuck while trying to using two diferent variables from diferent files in a command ex.

route add "text from file1" "test from file 2"

here is the code that i am trying to work with:

@echo off

if exist error.txt del error.txt >NUL
ipconfig | FIND "IPv4 Address. . . . . . . . . . . : 14" > ip.txt


for /f "tokens=14 delims= " %%a in (ip.txt)do call :pROCESS m=%a

:pROCESS
route delete 148.91.0.0 mask 255.255.0.0 %1

--------

What i want is to use the destination ips coming from an outside file to look something like this

route delete %1 %2

Please help
See less See more
Status
Not open for further replies.
1 - 3 of 3 Posts
%1 %2 variables come from the command line.

If you write text to a file you can then set it as a variable with the set command.

set /p Var1=<somefile.txt
Man! you rock!! thanks !
1 - 3 of 3 Posts
Status
Not open for further replies.
Top