Pergunta

so, I have a path in a .txt file made by my VB program. I need a batch to read it and place it in middle of a command. I have no idea how to do this, but I'll show you what I mean.

`add a firewall exception "path in textfile.txt" all configurations'

Sorry for being so unclear and I hope you get what I mean. And to the second question (not that important), how do I add a firewall exception with cmd?

Foi útil?

Solução

@echo off
for /f "usebackq tokens=* delims=" %%P in ("pathFile.txt") do set "path_to_exc=%%~P"
netsh firewall add allowedprogram "%path_to_exc%" "My_Application" ENABLE

?

Outras dicas

for /f "usebackq tokens=*" %%p in ("pathfile.txt") do (
    netsh firewall add allowedprogram program="%%~fp" name="%%~nxp" 
)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top