| 1. |
Solve : Finding file in C:\ drive? |
|
Answer» How could you have a batch file that can start a program that's placed ANYWHERE on the User's account? Lela: read the requirements listed. You'll find that dir /s does not meet them. I believe you are right. The Original Poster and all interested readers will use your solution.I could not find the BC solution of how to find a file?Billrich destroys another thread. Quote from: Salmon Trout on December 27, 2010, 05:46:16 PM cd /d C:\ & for /f "delims=" %%A in ('dir /b /s "file.txt"') do start /d "%%~dpA" file.txt The above is a sophisticated solution to a very simple problem. KISS ( Keep It Simple Sam ) cd \ dir /s file.txt Quote from: GingerRogers on December 28, 2010, 01:45:57 PM The above is a sophisticated solution to a very simple problem. ... and comes back and does it again. Ginger, why did you stop dancing with Red Adair?* You have not understood the OP's question: find the file and start it, supplying its folder name as a parameter to the start command. *Yes, I know... Probably time to lock. If the OP wants to use my script sample and has queries they could PM me. This Billrich problem really needs sorting out. Quote from: Salmon Trout on December 27, 2010, 05:46:16 PM cd /d C:\ & for /f "delims=" %%A in ('dir /b /s "file.txt"') do start /d "%%~dpA" file.txt This works great, but it does take a while :/ Quote from: GingerRogers on December 28, 2010, 01:45:57 PM The above is a sophisticated solution to a very simple problem. This one locates the directory of the file but how could you make it open it up once it has found it?When a text file is at commamd prompt or on a line by its self, notepad will open the file automatically Code: [Select]echo off cd \ dir /s /b %1 dir /s /b %1 > c:\test\displaytxt.bat cd c:\test\ c:\test\displaytxt.bat Output: c:\test> findtxt.bat file.txt c:\folder\file.txt c:\test> One line vs. six lines...hmm, they both do the same thing, but one line is better. Quote from: Helpmeh on December 28, 2010, 08:10:35 PM One line vs. six lines...hmm, they both do the same thing, but one line is better. Are you sure? The original poster mentioned how slow the one line is. Quote from: Teacher on December 28, 2010, 09:13:17 PM The original poster mentioned how slow the one line is. Dir /s on the system drive is going to be slow whichever way you package it, Bill. Why haven't you been banned YET? |
|