ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE. Software > Coding Snacks

Script/batch file that copies two files from a drive(usb) to a location

<< < (3/6) > >>

Yes, it appears correct.
Make sure that the batch file is started from the USB device. Will you keep that batch file there?

another hint: in case you gave "Al lUsers" as an example to protect your privacy (well done!), and plan to write your batch file so that it copies to your personal desktop folder, you could use the build-in environment variable "USERPROFILE" like this:

--- ---@echo off
for %%f in (myicon.ico, myieshortcut.url) do copy "\TestCopy\%%f" "%USERPROFILE%\Desktop\TestCopy\datafolder"

That will copy the two named files from the folder TestCopy in the root of the current drive to the folder TestCopy of your personal desktop.

Buddy list is great!
Have fun!

Is there anything I can do for you my friend?

--- End quote ---

Yes, please continue asking questions, that I can answer. That keeps me off the road. :)


Ok, then I will do so. =)

Do you think there is a way that the batch file can take whatever name it's called and input that name to a copied file?

For example:
copy C:\TestCopy\myicon.ico C:\TestCopy\datafolder
rename C:\TestCopy\myshortcut.ico   \myshortcut.ico + batchfilename.bat

Let me explain further. Lets say we have a batch file called joe.bat
Can we have joe appended to the name of the shortcut called myfaveshortcut via the very same batch file?
So the name of the shortcut will get personalized to the name of a person on the batch file.
So lets say I give the batch file to Cindy, then she would just rename the batch file to cindy.bat and that the name that would be appended to the shortcut's filename;

I was hoping something like that could be done. You may not know or maybe it is not possible, but if you do know and it is I will definitely search for a way. =)

Yes, than can be done. I have to admit that I am not very good at the syntax of batch files written for cmd.exe. I am happy to try and find solutions for your needs. But I wonder if you would consider to use an alternative "command line interpreter". I am used to write batch files for 4DOS, which is open source and free. It used to cost money, but not anymore. I would be able to give sound advice in case you are interested. You would not even have to install it, just copy into the same directory as the batch file you are writing, and I can show you how to make use of the powerful options that 4DOS gives you.

So will it be cmd.exe or 4DOS? Please don't feel pushed to something that you don't want, be honest. It would just easier for me to give hints quickly.

I go and search for the link now.

4DOS Revived!

Click on the button that says "Binaries" to download the zip file. For a start, you would only need one file from inside called


[0] Message Index

[#] Next page

[*] Previous page

Go to full version