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

<< < (4/6) > >>

the powerful options that 4DOS gives you
-wolf.b (November 15, 2007, 08:10 PM)
--- End quote ---

I heartily second the recommendation to use 4DOS (better yet, 4NT).

Yes, I am interested as long as it doesn't require the program to be installed in order for the scripts to work on any other computer: XP, Vista.

I will check the link out. THanks for the recommendation. I am interested in learning more.

No need to install it. We don't want to create dependencies. The batch files for 4DOS will work on many OS: all MS DOS versions since version 3.3 (1990[edit:1988]). All Windows versions since 3.0. As cranioscopical has pointed out correctly, the alternative 4NT is recommended for MS OS that are based on what they call "New Technology", such as Windows NT, Win2000, Win2003, WinXP, and Vista. The drawback is that you only get a time limited version for free. The full version is quite expensive. Everything that you write for 4DOS will be useful for 4NT as well. So I suggested 4DOS for a start and you can always change to 4NT later. At the moment I think for learning batch commands the free 4DOS will be good.

wolf.b is doing a good job as an instructor. I see one question has been unanswered. One about renaming. I will throw out a hint that batch files can take optional parameters. And a second hint - there is a reason why it is %%f and not %f. Keep that in mind when using your optional parameters in your batch file.

wolf.b, back to you wise teacher.

Thanks tinjaw,

Yes , I should have specifically said in reply #13, that the renaming can be done, instead of just
... that can be done.

--- End quote ---
My reason for "breaking" the flow of discussion at that point was to admit that
* eighther I have to go and study the syntax of cmd.exe (I really should do that!) and both of foolios and myself benefit from the discussion at a very slow rate (nothing wrong with that), or
* we switch to an alternative command line interpreter.
In my humble opinion, it is easier to start learning batch programming for 4DOS than it is to learn it for cmd.exe. Let me admit that my opinion is mainly based on the fact that I never really bothered to tackle the second, because I thought why learn a batch "dialect" that does not give good help. I am very fond of the help system that came with MS-DOS 6.22 and 7.10. Only many years later I had first contact with cmd.exe, which I believe is also much more powerful than But secondary to lack of good help being available to me, and the fact that 4DOS did everything I wanted it to do, and I already knew the features, I ended up ignoring cmd.exe as a command line interpreter.

For now I just give a sample batch file that I think will be easy enough for beginners to look at, and that slowly introduces some of the power of 4DOS:

--- ---:: TEST.BAT
:: by Wolf
@echo off

:: The following line will branch the flow of execution the the label called
:: Continue, if the expression evaluation returns true. All MS DOS command
:: line processors will evaluaye the condition as false because they treat
:: both sides of the double equal signs as STRINGS. "1.0" and "01" are not
:: the same. 4DOS has the ability to recognise the case here that on both
:: sides of the double equal signs, we have numerical expressions, that
:: evaluate to the same number.

if 1.0 == 01 goto Continue

:: default command line processor will call 4DOS to run the same batch as
:: well, with added parameters on the command line. After 4DOS finishes, it
:: will give control back to the default command line processor.
if exist /c %0 this is test batch
if not exist echo Sorry, 4DOS.COM not found.

goto End

echo Command line: %0&
echo Command line parameters: %&
echo Batch file name:   %0
echo First parameter:   %1
echo Second parameter:  %2
echo Third parameter:   %3
echo Fourth parameter:  %4


In case anybody wants to provide enlightenment, as to what the equivalent batch would be for cmd.exe, please post. In the meantime I do a bit of research myself.



[0] Message Index

[#] Next page

[*] Previous page

Go to full version