I have this MS-DOS 6.22 machine which maps a network drive to a SAMBA share on a Raspberry PI. The PI is powered by a USB lead from the DOS machine, so the two power up together.
The mapping starts when this happens near the end of AUTOEXEC.BAT
net logon samba mypassword /yes
As you can imagine there is a bit of a race with both computers booting up, and often the mapping will be attempted before Samba is ready.
Googling for "delay in batch file" gives links like this, but quickly going through the options:
PAUSE
- needs a key-press, no keyboard is attached on siteSLEEP
- not in this version of DOSTIMEOUT
- dittoPING 127.0.0.1 -n 10
- this ping ignores -n
The other suggestions listed are all for Windows.
How can I put a delay in, or otherwise wait for Samba to become ready?
(It may be possible to get the PI to boot quicker - that's off topic here but if there's interest in that I'll open another question over here)
NET DIAG /PING localhost
which consumes about 5 seconds.net logon
command returns an error value then you should be able to access it in%ERRORLEVEL%
, and then you can do agoto
loop that goes on until it succeeds.