How to Write a CMD Script to Mount and Use ISO File
I have an ISO file name lfs-ms.iso located at the following directory:
F:MSlfs-ms.iso
This ISO file contains an executable called lfs-inst.exe. I use this file many a times so I have to mount the ISO file manually every time and then open this executable. I wish to automate this process by using a command line script (.cmd). So I am building a script that first navigates to this directory, mounts the ISO file there and then opens the executable as mentioned above.
@echo off
cd F:MS
mount lfs-ms.iso
lfs-inst.exe
I have tried this but that's not working. Can someone help me how to do it.
windows-10 cmd.exe
add a comment |
I have an ISO file name lfs-ms.iso located at the following directory:
F:MSlfs-ms.iso
This ISO file contains an executable called lfs-inst.exe. I use this file many a times so I have to mount the ISO file manually every time and then open this executable. I wish to automate this process by using a command line script (.cmd). So I am building a script that first navigates to this directory, mounts the ISO file there and then opens the executable as mentioned above.
@echo off
cd F:MS
mount lfs-ms.iso
lfs-inst.exe
I have tried this but that's not working. Can someone help me how to do it.
windows-10 cmd.exe
Where does that mount command come from ? As far as I know there isn't any mount command in Windows 10...
– Tonny
Dec 28 '18 at 14:03
Possible duplicate of How can I mount an ISO via PowerShell/programmatically?
– LotPings
Dec 28 '18 at 14:06
@LotPings Not an exact duplicate, But PowerShell is the way to go. You will also need PowerShell to determine the drive-letter the ISO got. AFAIK you can't mount it on a folder, only as random drive-letter.
– Tonny
Dec 28 '18 at 14:11
The script should not only mount the ISO file, it should also run the executable lfs-inst.exe that resides in it.
– Sam
Dec 28 '18 at 14:45
add a comment |
I have an ISO file name lfs-ms.iso located at the following directory:
F:MSlfs-ms.iso
This ISO file contains an executable called lfs-inst.exe. I use this file many a times so I have to mount the ISO file manually every time and then open this executable. I wish to automate this process by using a command line script (.cmd). So I am building a script that first navigates to this directory, mounts the ISO file there and then opens the executable as mentioned above.
@echo off
cd F:MS
mount lfs-ms.iso
lfs-inst.exe
I have tried this but that's not working. Can someone help me how to do it.
windows-10 cmd.exe
I have an ISO file name lfs-ms.iso located at the following directory:
F:MSlfs-ms.iso
This ISO file contains an executable called lfs-inst.exe. I use this file many a times so I have to mount the ISO file manually every time and then open this executable. I wish to automate this process by using a command line script (.cmd). So I am building a script that first navigates to this directory, mounts the ISO file there and then opens the executable as mentioned above.
@echo off
cd F:MS
mount lfs-ms.iso
lfs-inst.exe
I have tried this but that's not working. Can someone help me how to do it.
windows-10 cmd.exe
windows-10 cmd.exe
edited Dec 28 '18 at 15:21
Sam
asked Dec 28 '18 at 13:48
SamSam
92
92
Where does that mount command come from ? As far as I know there isn't any mount command in Windows 10...
– Tonny
Dec 28 '18 at 14:03
Possible duplicate of How can I mount an ISO via PowerShell/programmatically?
– LotPings
Dec 28 '18 at 14:06
@LotPings Not an exact duplicate, But PowerShell is the way to go. You will also need PowerShell to determine the drive-letter the ISO got. AFAIK you can't mount it on a folder, only as random drive-letter.
– Tonny
Dec 28 '18 at 14:11
The script should not only mount the ISO file, it should also run the executable lfs-inst.exe that resides in it.
– Sam
Dec 28 '18 at 14:45
add a comment |
Where does that mount command come from ? As far as I know there isn't any mount command in Windows 10...
– Tonny
Dec 28 '18 at 14:03
Possible duplicate of How can I mount an ISO via PowerShell/programmatically?
– LotPings
Dec 28 '18 at 14:06
@LotPings Not an exact duplicate, But PowerShell is the way to go. You will also need PowerShell to determine the drive-letter the ISO got. AFAIK you can't mount it on a folder, only as random drive-letter.
– Tonny
Dec 28 '18 at 14:11
The script should not only mount the ISO file, it should also run the executable lfs-inst.exe that resides in it.
– Sam
Dec 28 '18 at 14:45
Where does that mount command come from ? As far as I know there isn't any mount command in Windows 10...
– Tonny
Dec 28 '18 at 14:03
Where does that mount command come from ? As far as I know there isn't any mount command in Windows 10...
– Tonny
Dec 28 '18 at 14:03
Possible duplicate of How can I mount an ISO via PowerShell/programmatically?
– LotPings
Dec 28 '18 at 14:06
Possible duplicate of How can I mount an ISO via PowerShell/programmatically?
– LotPings
Dec 28 '18 at 14:06
@LotPings Not an exact duplicate, But PowerShell is the way to go. You will also need PowerShell to determine the drive-letter the ISO got. AFAIK you can't mount it on a folder, only as random drive-letter.
– Tonny
Dec 28 '18 at 14:11
@LotPings Not an exact duplicate, But PowerShell is the way to go. You will also need PowerShell to determine the drive-letter the ISO got. AFAIK you can't mount it on a folder, only as random drive-letter.
– Tonny
Dec 28 '18 at 14:11
The script should not only mount the ISO file, it should also run the executable lfs-inst.exe that resides in it.
– Sam
Dec 28 '18 at 14:45
The script should not only mount the ISO file, it should also run the executable lfs-inst.exe that resides in it.
– Sam
Dec 28 '18 at 14:45
add a comment |
1 Answer
1
active
oldest
votes
By default, doubleclicking an .iso file will mount it in windows 10. If you have not altered this behavior, you can use the following command to do the same:
start lfs-ms.iso
Once the command is executed, the iso is mounted the same way it would be if you double click it.
So a dvd-drive appears in explorer with a driveletter attached to it, and the file is inside. Find out what drive letter the drive has, and use that in your script. I will assume G: here.
The rest of the script can navigate to the drive and execute the file.
Your batch file would look like this:
start lfs-ms.iso
g:
lfs-ms.exe
1
Might consider adding a method to eject via command too if possible to fully automate if that's of importance to the OP mount and executable execution. This will work without even usingstartand just pointing to the iso on my Win 10 system too btw!!
– Pimp Juice IT
Dec 28 '18 at 15:48
I don't know how to eject via commandline without going the powershell route.
– LPChip
Dec 28 '18 at 16:00
If you have edited the default behaviour for *.iso files, and you wish to open the file (mount to g: drive or something), replacestartwithexplorer.
– Ultrasonic54321
Dec 28 '18 at 16:16
Do I have to make a .bat file or a .cmd file for the above answer.
– Sam
Dec 28 '18 at 16:43
@Sam It should work with either.bator.cmdextension either way for the commands listed in this answer. If you are trying to automate as you indicated, then yes you will want to create a script that you can run ad-hoc as-needed, on a schedule, etc. The question is whether or not the drive letter is of importance or if you can simple hard-code and be assured the same drive letter is always used when the iso is mounted by Windows. If this is of importance, then you may want to also figure out a way to disconnect the mounted drive via command line afterwards.
– Pimp Juice IT
Dec 28 '18 at 16:52
|
show 1 more comment
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1388453%2fhow-to-write-a-cmd-script-to-mount-and-use-iso-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
By default, doubleclicking an .iso file will mount it in windows 10. If you have not altered this behavior, you can use the following command to do the same:
start lfs-ms.iso
Once the command is executed, the iso is mounted the same way it would be if you double click it.
So a dvd-drive appears in explorer with a driveletter attached to it, and the file is inside. Find out what drive letter the drive has, and use that in your script. I will assume G: here.
The rest of the script can navigate to the drive and execute the file.
Your batch file would look like this:
start lfs-ms.iso
g:
lfs-ms.exe
1
Might consider adding a method to eject via command too if possible to fully automate if that's of importance to the OP mount and executable execution. This will work without even usingstartand just pointing to the iso on my Win 10 system too btw!!
– Pimp Juice IT
Dec 28 '18 at 15:48
I don't know how to eject via commandline without going the powershell route.
– LPChip
Dec 28 '18 at 16:00
If you have edited the default behaviour for *.iso files, and you wish to open the file (mount to g: drive or something), replacestartwithexplorer.
– Ultrasonic54321
Dec 28 '18 at 16:16
Do I have to make a .bat file or a .cmd file for the above answer.
– Sam
Dec 28 '18 at 16:43
@Sam It should work with either.bator.cmdextension either way for the commands listed in this answer. If you are trying to automate as you indicated, then yes you will want to create a script that you can run ad-hoc as-needed, on a schedule, etc. The question is whether or not the drive letter is of importance or if you can simple hard-code and be assured the same drive letter is always used when the iso is mounted by Windows. If this is of importance, then you may want to also figure out a way to disconnect the mounted drive via command line afterwards.
– Pimp Juice IT
Dec 28 '18 at 16:52
|
show 1 more comment
By default, doubleclicking an .iso file will mount it in windows 10. If you have not altered this behavior, you can use the following command to do the same:
start lfs-ms.iso
Once the command is executed, the iso is mounted the same way it would be if you double click it.
So a dvd-drive appears in explorer with a driveletter attached to it, and the file is inside. Find out what drive letter the drive has, and use that in your script. I will assume G: here.
The rest of the script can navigate to the drive and execute the file.
Your batch file would look like this:
start lfs-ms.iso
g:
lfs-ms.exe
1
Might consider adding a method to eject via command too if possible to fully automate if that's of importance to the OP mount and executable execution. This will work without even usingstartand just pointing to the iso on my Win 10 system too btw!!
– Pimp Juice IT
Dec 28 '18 at 15:48
I don't know how to eject via commandline without going the powershell route.
– LPChip
Dec 28 '18 at 16:00
If you have edited the default behaviour for *.iso files, and you wish to open the file (mount to g: drive or something), replacestartwithexplorer.
– Ultrasonic54321
Dec 28 '18 at 16:16
Do I have to make a .bat file or a .cmd file for the above answer.
– Sam
Dec 28 '18 at 16:43
@Sam It should work with either.bator.cmdextension either way for the commands listed in this answer. If you are trying to automate as you indicated, then yes you will want to create a script that you can run ad-hoc as-needed, on a schedule, etc. The question is whether or not the drive letter is of importance or if you can simple hard-code and be assured the same drive letter is always used when the iso is mounted by Windows. If this is of importance, then you may want to also figure out a way to disconnect the mounted drive via command line afterwards.
– Pimp Juice IT
Dec 28 '18 at 16:52
|
show 1 more comment
By default, doubleclicking an .iso file will mount it in windows 10. If you have not altered this behavior, you can use the following command to do the same:
start lfs-ms.iso
Once the command is executed, the iso is mounted the same way it would be if you double click it.
So a dvd-drive appears in explorer with a driveletter attached to it, and the file is inside. Find out what drive letter the drive has, and use that in your script. I will assume G: here.
The rest of the script can navigate to the drive and execute the file.
Your batch file would look like this:
start lfs-ms.iso
g:
lfs-ms.exe
By default, doubleclicking an .iso file will mount it in windows 10. If you have not altered this behavior, you can use the following command to do the same:
start lfs-ms.iso
Once the command is executed, the iso is mounted the same way it would be if you double click it.
So a dvd-drive appears in explorer with a driveletter attached to it, and the file is inside. Find out what drive letter the drive has, and use that in your script. I will assume G: here.
The rest of the script can navigate to the drive and execute the file.
Your batch file would look like this:
start lfs-ms.iso
g:
lfs-ms.exe
answered Dec 28 '18 at 15:43
LPChipLPChip
35.8k55185
35.8k55185
1
Might consider adding a method to eject via command too if possible to fully automate if that's of importance to the OP mount and executable execution. This will work without even usingstartand just pointing to the iso on my Win 10 system too btw!!
– Pimp Juice IT
Dec 28 '18 at 15:48
I don't know how to eject via commandline without going the powershell route.
– LPChip
Dec 28 '18 at 16:00
If you have edited the default behaviour for *.iso files, and you wish to open the file (mount to g: drive or something), replacestartwithexplorer.
– Ultrasonic54321
Dec 28 '18 at 16:16
Do I have to make a .bat file or a .cmd file for the above answer.
– Sam
Dec 28 '18 at 16:43
@Sam It should work with either.bator.cmdextension either way for the commands listed in this answer. If you are trying to automate as you indicated, then yes you will want to create a script that you can run ad-hoc as-needed, on a schedule, etc. The question is whether or not the drive letter is of importance or if you can simple hard-code and be assured the same drive letter is always used when the iso is mounted by Windows. If this is of importance, then you may want to also figure out a way to disconnect the mounted drive via command line afterwards.
– Pimp Juice IT
Dec 28 '18 at 16:52
|
show 1 more comment
1
Might consider adding a method to eject via command too if possible to fully automate if that's of importance to the OP mount and executable execution. This will work without even usingstartand just pointing to the iso on my Win 10 system too btw!!
– Pimp Juice IT
Dec 28 '18 at 15:48
I don't know how to eject via commandline without going the powershell route.
– LPChip
Dec 28 '18 at 16:00
If you have edited the default behaviour for *.iso files, and you wish to open the file (mount to g: drive or something), replacestartwithexplorer.
– Ultrasonic54321
Dec 28 '18 at 16:16
Do I have to make a .bat file or a .cmd file for the above answer.
– Sam
Dec 28 '18 at 16:43
@Sam It should work with either.bator.cmdextension either way for the commands listed in this answer. If you are trying to automate as you indicated, then yes you will want to create a script that you can run ad-hoc as-needed, on a schedule, etc. The question is whether or not the drive letter is of importance or if you can simple hard-code and be assured the same drive letter is always used when the iso is mounted by Windows. If this is of importance, then you may want to also figure out a way to disconnect the mounted drive via command line afterwards.
– Pimp Juice IT
Dec 28 '18 at 16:52
1
1
Might consider adding a method to eject via command too if possible to fully automate if that's of importance to the OP mount and executable execution. This will work without even using
start and just pointing to the iso on my Win 10 system too btw!!– Pimp Juice IT
Dec 28 '18 at 15:48
Might consider adding a method to eject via command too if possible to fully automate if that's of importance to the OP mount and executable execution. This will work without even using
start and just pointing to the iso on my Win 10 system too btw!!– Pimp Juice IT
Dec 28 '18 at 15:48
I don't know how to eject via commandline without going the powershell route.
– LPChip
Dec 28 '18 at 16:00
I don't know how to eject via commandline without going the powershell route.
– LPChip
Dec 28 '18 at 16:00
If you have edited the default behaviour for *.iso files, and you wish to open the file (mount to g: drive or something), replace
start with explorer.– Ultrasonic54321
Dec 28 '18 at 16:16
If you have edited the default behaviour for *.iso files, and you wish to open the file (mount to g: drive or something), replace
start with explorer.– Ultrasonic54321
Dec 28 '18 at 16:16
Do I have to make a .bat file or a .cmd file for the above answer.
– Sam
Dec 28 '18 at 16:43
Do I have to make a .bat file or a .cmd file for the above answer.
– Sam
Dec 28 '18 at 16:43
@Sam It should work with either
.bat or .cmd extension either way for the commands listed in this answer. If you are trying to automate as you indicated, then yes you will want to create a script that you can run ad-hoc as-needed, on a schedule, etc. The question is whether or not the drive letter is of importance or if you can simple hard-code and be assured the same drive letter is always used when the iso is mounted by Windows. If this is of importance, then you may want to also figure out a way to disconnect the mounted drive via command line afterwards.– Pimp Juice IT
Dec 28 '18 at 16:52
@Sam It should work with either
.bat or .cmd extension either way for the commands listed in this answer. If you are trying to automate as you indicated, then yes you will want to create a script that you can run ad-hoc as-needed, on a schedule, etc. The question is whether or not the drive letter is of importance or if you can simple hard-code and be assured the same drive letter is always used when the iso is mounted by Windows. If this is of importance, then you may want to also figure out a way to disconnect the mounted drive via command line afterwards.– Pimp Juice IT
Dec 28 '18 at 16:52
|
show 1 more comment
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1388453%2fhow-to-write-a-cmd-script-to-mount-and-use-iso-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Where does that mount command come from ? As far as I know there isn't any mount command in Windows 10...
– Tonny
Dec 28 '18 at 14:03
Possible duplicate of How can I mount an ISO via PowerShell/programmatically?
– LotPings
Dec 28 '18 at 14:06
@LotPings Not an exact duplicate, But PowerShell is the way to go. You will also need PowerShell to determine the drive-letter the ISO got. AFAIK you can't mount it on a folder, only as random drive-letter.
– Tonny
Dec 28 '18 at 14:11
The script should not only mount the ISO file, it should also run the executable lfs-inst.exe that resides in it.
– Sam
Dec 28 '18 at 14:45