> ## Content Index
> Fetch the complete content index at: https://kudithipudi.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# For loop in Windows command shell
- URL: https://kudithipudi.org/for-loop-in-windows-command-shell/
- Published: 2012-11-05T14:35:52.000Z
- Updated: 2012-11-05T14:35:52.000Z
- Description: For my records, syntax for running a simple for loop in command prompt [code]for %i in (SERVER1 SERVER2) do nslookup %i [/code] note : Looks like...
- Author: admin
- Tags: Programming, Technology, Uncategorized, Windows, #wp, #wp-post, #Import 2026-08-23 02:32

For my records, syntax for running a simple for loop in command prompt

```
for %i in (SERVER1 SERVER2) do nslookup %i
```

note :

- Looks like the variable can only be single characters. i.e you cannot name the variable %server
- For using the same syntax in a batch file, you have to add another % to the variable. i.e. %i becomes %%i