Skip to content
View in the app

A better way to browse. Learn more.

Unraid

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.

DOS SHELL for /F in file

Featured Replies

Need help with this for loop - once more...  :-[

This time it's a batch file in DOS console.

I want to process a file line by line but it will always cut/break after a blank in the line.

Lines without blanks work perfectly.

 

My code at the moment:

FOR /F "delims=*" %%i IN (%tmpfile%) DO CALL :BODY %%i

 

I can't remember the countless possibilities of delims & tokens that I googled & tested.

I don't believe it's that complicated but obviously I can't handle it.

 

Appreciate your help!

I think it is not recognizing the "delims=*".  I don't think an asterisk is supported and is it defaulting to a space.  Change the asterisk to something that won't be in the data and add "tokens=*".  Something like this:

 

FOR /F "tokens=* delims=;" %%i IN (%tmpfile%) DO CALL :BODY %%i

 

assuming there will not be a semicolon in the data.

 

This site is a great reference for Windows/DOS batch commands: http://ss64.com/nt/for_f.html

This site is a great reference for Windows/DOS batch commands: http://ss64.com/nt/for_f.html

 

Wow!  I use FOR loops a bit, but there's plenty there that I was not aware of.  Really useful stuff.  Thanks for sharing. 

  • Author

FOR /F "tokens=* delims=;" %%i IN (%tmpfile%) DO CALL :BODY %%i

 

Does not work.

Cuts off after blank.  :-\

Did you try

FOR /F "delims=^*" %%i IN (%tmpfile%) DO CALL :BODY %%i
  • Author

Just tried:

 

FOR /F "delims=^*" %%i IN (%tmpfile%) DO CALL :BODY %%i

 

and

 

FOR /F "tokens=* delims=^*" %%i IN (%tmpfile%) DO CALL :BODY %%i

 

No joy.  :-\

You need to add quotes to the parameter. Do the following:

 

FOR /F "delims=*" %%i IN (%tmpfile%) DO CALL :BODY "%%i"

 

:BODY

ECHO.%~1

GOTO :EOF

Note the quotes when calling the subroutine BODY, and inside the subroutine %~1, which removes the quotes. This example assumes that the lines do NOT contain the character *

  • Author

Great bonienl!

This is working!!!  :)

thx

 

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

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.