Computing.Net > Forums > Programming > Bat. get input file folder?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Bat. get input file folder?

Reply to Message Icon

Name: Hans Henrik
Date: August 6, 2008 at 06:05:06 Pacific
OS: XP
CPU/Ram: fast enought. 2 GB
Product: Dell~
Comment:

i have made a bat that moves files in a specified folder, and added some registry keys so i can right-click any file and run the bat on it.. but now i need to make the bat search the entire directory to...

this is the bat so far:
[CODE]@echo off
:sets
set /A FailSafe=0
set MoveFolder=C:\Documents and settings\all users\desktop\files\
:begin
move %1 "%MoveFolder%"
if not errorlevel=0 goto FailSafe
exit
:FailSafe
set /A FailSafe=%FailSafe%+1
if %FailSafe% == 5 echo an error, Errorlevel=%errorlevel% & pause & exit
goto begin[/CODE]

but now i need it to get the directory of the file, and go there, so i can move all files with specific names to (for example *test*)
like
[CODE]
move %1 "%MoveFolder%"
cd %InputFileFolder%
move *Test* "%MoveFolder%"[/CODE]

any idea how i can do this??



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: August 6, 2008 at 09:45:58 Pacific
Reply:

Hi
This help..

@echo off
cd>x.txt
set /p Folder=<x.txt
echo [%Folder%]


0

Response Number 2
Name: Razor2.3
Date: August 6, 2008 at 17:38:29 Pacific
Reply:

move %1 "%MoveFolder%"
cd /d %~dp1
move *Test* "%MoveFolder%"


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Bat. get input file folder?

Comparing Files+Folders using VBS www.computing.net/answers/programming/comparing-filesfolders-using-vbs/14112.html

How to get the file size? www.computing.net/answers/programming/how-to-get-the-file-size/12976.html

Percent Complete BAT File Attempt www.computing.net/answers/programming/percent-complete-bat-file-attempt/15078.html