Make an automatic task?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know exactly what I want to do from the old DOS days - trying to figure out
how to do it in Windows format.

Basically I want an icon on my desktop that will when clicked -
1 . erase a file from a specific location
2. copy a file from a specified folder
3. paste it to another folder

Seems so simple, but I don't know how to do it in Windows! Can someone help
me? THanks!
 
Hi Stoke:

You'd do that in the same way you would have in the "old DOS days":
Write a batch file. Depending on exactly what you want to accomplish,
you might use the del and copy commands.

Earl Grey
 
Earl Grey -

I wrote the batch file - named the icon do it.bat

I wrote it in notepad, and this is what it contains:

copy C:\Documents and Settings\cpc\My Documents\notecard.jpg
paste C:\Documents and Settings\cpc\Desktop

I thought that after clicking on the icon, I should have notecard.jpg on my
desktop, but it's not there...

What's missing??
 
Hello again:

I haven't written a batch file in many years, so you should probably ask
someone else. I never heard of a 'paste' command, since 'copy' copies
a file from a source to a destination.

Why not lookup 'how to write a batch file' on the web, where you can
also find the complete syntax for the 'copy' command.

Earl Grey
 
Try this from a command prompt first:

copy C:\Documents and Settings\cpc\My Documents\notecard.jpg C:\Documents
and Settings\cpc\Desktop

If that doesn't work and results in an error message, try adding quotes as
follows:
copy "C:\Documents and Settings\cpc\My Documents\notecard.jpg"
"C:\Documents and Settings\cpc\Desktop"

If you still get an error message, the folks over at
alt.msdos.batch.nt
would be happy to help; lots of experts on that group.

If it works, you're all set; make your batch fie.

HTH
Pop`
 
Replied to [Stoke]s message :
Earl Grey -

I wrote the batch file - named the icon do it.bat

CLick Start | Cmd
1) Type : del /? to know about del command.
Example of del : del /q "SomeFile"

2+3) Type : copy /? to know about copy command.
Example : copy "SomeFilePath" "SomeFIle OR Directory Path"
Example: copy "C:\Windows\regedit.exe" "E:\"
 
Stoke used his keyboard to write :
I wrote the batch file - named the icon do it.bat
I wrote it in notepad, and this is what it contains:

copy C:\Documents and Settings\cpc\My Documents\notecard.jpg
paste C:\Documents and Settings\cpc\Desktop

I thought that after clicking on the icon, I should have notecard.jpg on my
desktop, but it's not there...

The copy command accepts source and destination arguments, but if the
destination argument is missing, the files are copied to the current
directory. Windows does not have a paste command.
Besides - file/folder names with spaces must be enclosed with quotation
marks, so the commands you wrote should instead be (all in one line):

copy "c:\documents and settings\cpc\my documents\notecard.jpg"
"c:\documents and settings\cpc\desktop" /y

The /y argument tells the copy command to overwrite any existing files
without prompting for an accept.

Also, you might want to use some built-in Windows "helpers":

cd /d "%userprofile%"
copy "my documents\notecard.jpg" desktop /y

The cd command changes the active folder in the script to the home of
your current user profile - i.e. c:\documents and settings\cpc.
The copy command then relatively addresses the files instead of using
the full path. Quotation marks is not needed in the destination
argument as it does not contain space chararacters.


/klaus
 
Thu, 1 Feb 2007 08:07:14 -0800 from Stoke
I know exactly what I want to do from the old DOS days - trying to figure out
how to do it in Windows format.

Basically I want an icon on my desktop that will when clicked -
1 . erase a file from a specific location
2. copy a file from a specified folder
3. paste it to another folder

Right-click on desktop
New > Text document

Double-click it; Notepad will open. Type in these lines:

DEL "filepathandname"
COPY "filepathandname" "destinationpath"

(Of course you substitute the correct file names and paths. Keep the
quotes -- for some file paths and names they're not needed, but they
are need for some and don't hurt for the others.)

File > Save
File > Exit

Right-click on the icon and select Rename, then change it to
something ending in ".bat" (no quotes).
 
Stoke said:
Earl Grey -

I wrote the batch file - named the icon do it.bat

I wrote it in notepad, and this is what it contains:

copy C:\Documents and Settings\cpc\My Documents\notecard.jpg
paste C:\Documents and Settings\cpc\Desktop

I thought that after clicking on the icon, I should have notecard.jpg
on my desktop, but it's not there...

What's missing??


There is no paste command. The copy command takes *two* parameters, the one
you are copying from and the one you are copying to. If the second parameter
is omitted, it copies to the current directory.

So your two commands above should be replaced by one, as follows:

copy C:\Documents and Settings\cpc\My Documents\notecard.jpg C:\Documents
and Settings\cpc\Desktop
 
Thank you all - this is great!

Stan Brown said:
Thu, 1 Feb 2007 08:07:14 -0800 from Stoke


Right-click on desktop
New > Text document

Double-click it; Notepad will open. Type in these lines:

DEL "filepathandname"
COPY "filepathandname" "destinationpath"

(Of course you substitute the correct file names and paths. Keep the
quotes -- for some file paths and names they're not needed, but they
are need for some and don't hurt for the others.)

File > Save
File > Exit

Right-click on the icon and select Rename, then change it to
something ending in ".bat" (no quotes).
 
I have it figured out on my workstation - Now how would I reference a file on
amapped network drive? I tried just using P:\ and the file name, but i keep
getting a file not found error. Thanks
 
Back
Top