PDA

View Full Version : Problem with DTLite in command lines...



NiafNiaaark
05.09.2012, 09:26
Hi all, and sorry if that post is allready solved, but i tried to find the answer by myself, and it seems that I totally failed... :s

My question is pretty simple :
I'm trying to make a batch files, which create 5 virtual drives, then mount 5 .iso, let the user do what he have to, then unmount and remove virtual drives.

Here is my code :

@echo off

:Pointage vers Daemon Tools
cd "c:\Program Files (x86)\DAEMON Tools Lite\"

:Ajout des lecteurs virtuels
echo "Création des lecteurs virtuels, veuillez patienter..."
DTLite.exe -add dt
DTLite.exe -add dt
DTLite.exe -add dt
DTLite.exe -add dt
DTLite.exe -add dt
pause

:Montage des images
echo "Montage des images disques..."
DTLite.exe -mount dt, 0, "c:\Users\admin\Desktop\DvDs\Messages_et_Tutoriels. iso"
DTLite.exe -mount dt, 1, "c:\Users\admin\Desktop\DvDs\Phase_Travaux_1de4.iso"
DTLite.exe -mount dt, 2, "c:\Users\admin\Desktop\DvDs\Phase_Travaux_2de4.iso"
DTLite.exe -mount dt, 3, "c:\Users\admin\Desktop\DvDs\Phase_Travaux_3de4.iso"
DTLite.exe -mount dt, 4, "c:\Users\admin\Desktop\DvDs\Phase_Travaux_4de4.iso"
pause
echo "Les disques sont maintenant disponible dans <<Poste de travail>>."
echo "Ne fermez pas ce script."
echo "Une fois l'utilisation terminée, revenez simplement sur l'invite de commande et appuyez <<Enter>>."
pause

:Demontage des images
echo "Les images disques et les lecteurs vont être retirés..."
echo "ATTENTION : Les images ne doivent plus être en cours d'utilisation :"
echo "Si il reste des fenêtres ouvertes vers les DvDs, fermez-les, puis revenez à ce script et appuyez <<Enter>>."
Pause
DTLite.exe -unmount_all
DTLite.exe -remove dt, 0
DTLite.exe -remove dt, 1
DTLite.exe -remove dt, 2
DTLite.exe -remove dt, 3
DTLite.exe -remove dt, 4
echo "Les lecteurs ont bien été retirés..."
echo "Appuyez sur <<Entrée>> pour terminer le script."
Pause
exit


I'm doing it for another person of my company, who doesn't like computing and all that sort of things....
He's completely unskilled with Daemon tools, so I expected that a batch script whould have resolve his problem, by doing all the mount/unmount stuff for him.

Unfortunately, I obtain "syntax error" with all commands parameters.... :s

My operating system : Win 7 pro 64 bits
His operating system : Win XP pro sp2 (i know i've some line to change for the script to work on a 32 bits OS, but I think the problem doesn't come from this....)

My version of DTLite is the same than him, and the latest distributed nowadays (4.40.2.0131)

Thank you in advance, sorry for this long topic. :)

Sway
10.09.2012, 12:15
You can add and use up to 4 devices. According to your code, you tried to use 5 devices at the same time. That's the problem.

ra.dlanor
10.09.2012, 12:19
Hi there.
I'm not part of the DT staff but I do have some experience of batch problems related to yours, so I thought I'd give you my tips on what might have gone wrong for you.


Hi all, and sorry if that post is allready solved, but i tried to find the answer by myself, and it seems that I totally failed... :s
I'm not sure what post you refer to here, as yours is shown as #1 in this thread, but possibly some moderator moved it (?).


My question is pretty simple :
I'm trying to make a batch files, which create 5 virtual drives, then mount 5 .iso, let the user do what he have to, then unmount and remove virtual drives.
I see how it would work, but personally I prefer to keep the drives defined continuously, for faster use with variable mounting of images. (Might not apply for your needs though.)


Here is my code :

@echo off
For debugging in detail you should REM that first statement, and invoke the batch itself from an already opened command window (so you can save all resulting messages).


:Pointage vers Daemon Tools
cd "c:\Program Files (x86)\DAEMON Tools Lite\"
Here we have a potential problem, depending on where the batch file is stored when you invoke it, or rather what the active directory is when that is done. If you do it on any other drive than "c:", then the "cd" command will fail to affect the active directory. So if you're running the batch in a folder on "d:" then you'll have to do a switch of the active drive first, like this:

c:
cd "c:\Program Files (x86)\DAEMON Tools Lite\"


----- I'm skipping some of your stuff that I have no direct comment on -----
----- I'm just quoting one of your mount commands here, for later comment -----

DTLite.exe -mount dt, 0, "c:\Users\admin\Desktop\DvDs\Messages_et_Tutoriels. iso"
One notable fact here is that you rely on the active directory to contain the DTLite.exe file, and another is that you put only the final argument inside quote marks.


I'm doing it for another person of my company, who doesn't like computing and all that sort of things....
He's completely unskilled with Daemon tools, so I expected that a batch script whould have resolve his problem, by doing all the mount/unmount stuff for him.
That sounds like a good idea.


Unfortunately, I obtain "syntax error" with all commands parameters.... :s
I take this to mean that you get this error for the very first invocation of DTLite.exe by that batch, and for all those that follow as well (if it even runs that far).

This is very often an indication that the active directory is incorrectly set, so that the exe file to be launched can not be found. The command interpreter then sees that filename merely as an incorrect command name.


My operating system : Win 7 pro 64 bits
His operating system : Win XP pro sp2
I have both of these OS running here too on some of my computers.
(1 with Win7pro_x64, 2 with WinXPproSP2)


(i know i've some line to change for the script to work on a 32 bits OS, but I think the problem doesn't come from this....)
Most of my batch files run just fine on either of those OS, without any changes.
The main difference lies in the interference by UAC under Win7, for all powerful operations.
(Which is why most developers simply have to turn UAC off.)


My version of DTLite is the same than him, and the latest distributed nowadays (4.40.2.0131)
Either your post must be older than I thought, or you have somehow missed several updates..., since I have 4.45.4 !


Thank you in advance, sorry for this long topic. :)
Long posts are frequently needed to resolve technical issues.
A short post on such a topic is often useless due to lack of important details.

Now as to your problem, I see two possible causes for it.

1: If active directory at batch launch is NOT on c:, you need to add an explicit drive switch, as shown in my short code example above.

2: Windows' command interpreter as well as most EXE files that use parameters can often be very picky about argument quoting, sometimes 'disliking' having just one parameter quoted, but working fine if you quote the command line differently. Like I did in this example from one of my own batch files:

"C:\Program Files (x86)\DAEMON Tools Lite\DTLite.exe" -mount scsi, 0, "%ISO_dir%%disc%"

You might find it a little confusing that I here built the ISO file path from two batch variables, but that's not the difference significant to your problem.

The most significant difference here is that I explicitly included the full path of the EXE file. I had to do it that way, as my script needs to use a different active directory, for other accesses it makes to work properly. But in your case it should be enough to use an explicit drive switch before your "cd" command.

Best regards: ra.dlanor (aka: Ronald Andersson)

ra.dlanor
10.09.2012, 12:28
You can add and use up to 4 devices. According to your code, you tried to use 5 devices at the same time. That's the problem.
You are of course correct (I had momentarily forgotten that limit), but I think NiafNiaaark never got far enough for that problem to trigger.

He did say that he got a syntax error message for ALL of the commands, not just the fifth, so there must be something else causing those errors. And this implies that DTLite never even got launched for any of those cases.

In conclusion:
If he really needs all five ISOs mounted simultaneously, then I see no way for him to do it with the DTLite program, though possibly the Pro version can do it for him instead. (Right ?)

But if it's not absolutely necessary to have all five ISOs mounted at the same time, then I'd rather solve such a problem by making a small collection of batch files to switch the mounting of some ISO files that don't need to be simultaneously mounted, so that they use the same virtual drive.

Best regards: ra.dlanor (aka: Ronald Andersson)