0 Replies - 550 Views - Last Post: 01 April 2010 - 02:38 PM Rate Topic: -----

#1 openoutcome  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 51
  • Joined: 06-November 09

Batch File Help

Posted 01 April 2010 - 02:38 PM

I want to search for a file with a batch file, and copy it to my flash drive.

Here's an example, and it keeps saying "The system cannot find the file specified." I think it may be because the search result brings up two paths, and it's assigning both to variable "var". Could someone help me out, or put me on the right trail?

(say I'm looking for file doc1.txt)

@echo off

cd "%userprofile%"
set var = attrib /s doc1.txt
copy %var% e:\


This results in "The system cannot find the file specified." I know how to use the search pane in windows explorer.. so don't think I'm a retard. This is just my assignment. Thanks for any help!

P.S. When I state
%var%
after searching, it gives me the path.. along with some other info.. Maybe that's why it's screwing up?

It outputs:

A I C:\Users\(name)\Desktop\doc1.txt

And I also can't just go:

copy attrib /s doc1.txt e:\

This post has been edited by openoutcome: 01 April 2010 - 02:46 PM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1