0

I am new to programming in .net and I'm wondering what the C# equivalent of this command is:

dism.exe /mount-image /imagefile:‘<imagepath>' /mountDir:'volume' /Index:1
pesky_programmer
  • 131
  • 3
  • 12
  • 3
    [Give this page a read.](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/use-dism-in-windows-powershell-s14) So in your scenario, the cmdlet equivalent to that would be [`Mount-WindowsImage`](https://learn.microsoft.com/en-us/powershell/module/dism/mount-windowsimage?view=windowsserver2019-ps). `Mount-WindowsImage -ImagePath "c:\imagestore\install.vhd" -Index 1 -Path "c:\offline` – Abraham Zinala Jul 28 '21 at 01:41
  • in Powershell*** forgot to mention that. – Abraham Zinala Jul 28 '21 at 01:47
  • how do I use it in c# though? Also, I was just using the command I mentioned in the question in PowerShell and it worked. – pesky_programmer Jul 28 '21 at 01:48
  • 1
    Not too familiar with C# (if any), but you can take a look at this [page](https://learn.microsoft.com/en-us/powershell/scripting/developer/hosting/adding-and-invoking-commands?view=powershell-7.1) which should show you how to invoke that cmdlet from C#. Powershell is a shell, a *command-line* interface. So *command-line* utlities such as *Dism.exe*, can be ran from Powershell with almost no issue. Same reason why you can still use *Robocopy.exe* in powershell or any of the older utilities, since they're just that, utilities; hence the **.exe** ;) . – Abraham Zinala Jul 28 '21 at 01:52

0 Answers0