Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Help with a simple FOR /F loop in Batch file

$
0
0

Hello, I'm having an issue with a simple FOR loop in a batch file. According to the FOR command's syntax (Microsoft's Technet on FOR), this loop should read & echo each line of iwov.txt, but instead the loop doesn't run.  I'm aware that the TYPE command will do the same thing but my goal is to export, alter, & import this registry key, I just haven't gotten that far yet. Could someone help me figure out what's wrong with this loop?

SetLocal EnableDelayedExpansion
cd /d c:\deleteme\
reg export HKLM\SOFTWARE\Wow6432Node\Interwoven\Worksite\8.0\FileSite\Commands\Document iwov.txt /y
for /f "tokens=*" %%n in (C:\deleteme\iwov.txt) do (
    set rdln=%%n
    echo !rdln!
)


Contents of C:\deleteme\iwov.txt :

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Wow6432Node\Interwoven\WorkSite\8.0\FileSite\Commands\Document]
"Commands"="iManExt3.NewOpenCmd,iManExt.OpenROCmd,iManExt.PrintCmd,iManExt.ViewCmd"

Batch File Output:

c:\>c:\deleteme\tech.bat

c:\>SetLocal EnableDelayedExpansion

c:\>cd /d c:\deleteme\

c:\deleteme>reg export HKLM\SOFTWARE\Wow6432Node\Interwoven\Worksite\8.0\FileSite\Commands\Document iwov.txt /y
The operation completed successfully.

c:\deleteme>for /F "tokens=*" %%n in (C:\deleteme\iwov.txt) do (
set rdln=%%n
echo !n!
)

c:\>


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>