1.

Solve : Starting all files/exes in a directory??

Answer»

Hi All - FIRST post here. Trying to put together a batch file to make life a little easier.

I'd like to make a batch file open all files and programs within a single folder on a mapped network drive. These files and programs will change constantly, so I can't tell DOS the file names.
For example, I've got a folder on c:\ called "test". Inside of test I've got a url "digg.url" link and a shortcut to filemaker pro "fmp.lnk". I want them to both open when I run "test.bat"
I'm trying to use wildcards to make this happen. I thought it would be fairly straightforward.

So far, I've got:

cd c:\test
start *.*

I get "windows cannot find file *.*".

I'm not experienced in dos - I can navigate and run a command here and there.

Help is much appreciated.
Maybe something like this?

Code: [Select]@Echo Off
CD /D C:\Test
Dir /B > C:\Content.txt
For /F "tokens=*" %%i In (C:\Content.txt) DO Start "" /WAIT %%i
You can also do it without creating a content file (and without waiting) like this:
Code: [Select]cd "C:\test"
for /f "tokens=*" %%a in ('dir /a-d /b') do start "" "%%a"this will work in pure DOS:

Code: [Select]cd C:\test
for %%P in (*.exe) do start %%P
Thanks for your suggestions. I'll give these a shot and update later.We have a Winner! (Almost).

So I plugged in my original test values using a local drive. Worked perfectly.
I then plugged in my actual working values - instead of
cd "C:\test"

I put it to

cd "Z:\test"

Z being a shared drive on the domain that is mapped to the local machine.

When I do that, the batch file DEFAULTS to the directory where the batch file is stored, and opens everything in that directory (including the batch file itself, which opens everything + itself, which creates a loop that ends up opening dozens of windows worth of the same thing).

I have verified that I am connected and authenticated to the mapped drive.

In the end, this .bat is only functional if it is ABLE to GRAB its items from a mapped network drive.

Any ideas? I feel like I'm on the cusp of success.\

Thanks in advance.

Quote from: GuruGary on February 11, 2009, 08:55:24 AM

You can also do it without creating a content file (and without waiting) like this:
Code: [Select]cd "C:\test"
for /f "tokens=*" %%a in ('dir /a-d /b') do start "" "%%a"

If you are changing drive letters you need the /D switch on the CD (or manually change the drive letter). So try this instead:
Code: [Select]cd /D "C:\test"
for /f "tokens=*" %%a in ('dir /a-d /b') do start "" "%%a"It works perfectly.

+3 internets, and the right to name my firstborn.

Thanks!!
"Sparky".....



Discussion

No Comment Found