Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

cmd batch files help

Apr 9, 2008 6:57AM PDT

Hi all,
I have the following line in a .cmd file, main.cmd

FOR /F %%i in (jobs.txt) do jobs.cmd %%i

The jobs.cmd file has this line of code:
cscript.exe %i

The jobs.txt file has a bunch of vbscripts that need to be executed.

When I run the file main.cmd, it tells me "There is no file extension in g:\g. Is some thing wrong with my code?
Thanks.

Discussion is locked

- Collapse -
It's simpler than it looks
Apr 10, 2008 9:05AM PDT

The FOR command opens the JOBS.TXT file and reads all blank seperated tokens. Most likely, it has paths to script files, one per line.

The JOBS.CMD file is then called for each of the read tokens in JOBS.TXT.

The problem is probably in JOBS.TXT. One of the paths is missing an extention.

- Collapse -
What is DELIMS set to?
Apr 10, 2008 9:48AM PDT

delims=xxx The delimiter character(s) (default = a space)

- Collapse -
Why not ...
Apr 11, 2008 5:17AM PDT

write a VBscript (.vbs) to read the jobs.txt and generate the batch file that should be executed. Much easier to test and debug.

Kees