Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Need help on creating a batch file.

Featured Replies

Hi All,

I have created following batch file which will read value from a text file and set a variable. But somehow it's not working, to debug, i have added several pause on the file, and found that it's automatically closing after executing FOR statement. :o

But if i execute the for statement on direct command line it's working and also it's setting the variable.

Please help me to fix this

@echo off
pause
FOR /F "tokens=2" %a in (C:\chk.txt) do set _port=%a
pause
::set _reg=open
if "%_port%" == "open" ( echo : True :
pause
exit)
echo : False :
pause
exit

Content of the chk.txt is:

25/tcp open  smtp

After executing FOR statement directly on command prompt.

C:\>FOR /F "tokens=2" %a in (C:\chk.txt) do set _port=%a

C:\>set _port=open

C:\>echo %_port%
open

C:\>

Solved!!

...by adding a % sign to have two in front of variables:

  • %a on command line
  • %%a in batch script

http://www.boot-land.net/forums/index.php?showtopic=11604

@justhink

Just to clear the sense of my post, the plot WITHOUT it:

  1. you have a problem
  2. you solved it, and say so WITHOUT telling HOW
  3. noone else will ever be able to benefit from the reported experience :blink:

and the plot WITH it:

  1. you have a problem
  2. you solved it
  3. HOW it was solved is posted
  4. someone else with your same problem may benefit from the reported experience :thumbup

jaclaz

  • Author

It appears that they received a response from elsewhere first but couldn't be bothered to update us!

Sure, that's the same link. ;)

jaclaz

I am extremely sorry for doing so, I was i hurry to solve the problem, and after it solved, i was busy with another problem.

So sorry again, and in future i will not do the same..

JusTy

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.