Messages - wolf.b [ switch to compact view ]

Pages: prev1 2 3 4 [5] 6 7 8 9 10 ... 13next
21
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 4dos.com 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.

22
Is there anything I can do for you my friend?

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

Wolf

23
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!

24
Only after I wrote my last reply, I noticed your edits.

Try this:
@echo off
for %%f in (myicon.ico, myieshortcut) do copy "C:\Documents and Settings\All Users\Desktop\TestCopy\%%f" "C:\Documents and Settings\All Users\Desktop\TestCopy\datafolder"

The answer to spaces in the file name or folder name is double quotes.


Greetings
Wolf

25
It displayed the file extension. Thank you so much.
My pleasure.

At the command prompt you can type: help for > help.txt and study the help text file that appears in the current directory. But it is awful to read. My interpretation would be:

for %%f does assign a value to an environment variable called %f. The value will be the string "myicon.ico" in the first iteration, and "myieshortcut.url" in the second iteration. Those values are found by the for command inside the set that you give it after the keyword in between the round brackets here: in (myicon.ico, myieshortcut.url). I took the liberty to assume that the extension actually is url. For every value the for command finds inside the "set", it creates a command that looks like the rest of the commandline (after the keyword do) and the expression %%f is substituted with the current value of the environment variable. So it does in this particular case the following two commands like this:
copy C:\TestCopy\myicon.ico C:\TestCopy\datafolder
copy C:\TestCopy\myieshortcut.url C:\TestCopy\datafolder
The syntax in a easy (not entirely correct) version is: for xxx in (yyy) do zzz
This is just to illustrate the position of the necessary keywords.

For studying if your intended lines are correctly created, you could use the echo command like this:
@echo off
for %%f in (myicon.ico, myieshortcut) do echo copy C:\TestCopy\%%f C:\TestCopy\datafolder


Greetings
Wolf


Pages: prev1 2 3 4 [5] 6 7 8 9 10 ... 13next
Go to full version