Share via

ISO File Creation

Anonymous
2021-09-15T01:05:05+00:00

Hi, is there a way to make an ISO File from some folders?

Windows for home | Windows 10 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Rodrigo Queiroz 77,250 Reputation points Independent Advisor
    2021-09-15T03:07:33+00:00

    Well, after long research I've found a way to do it using PowerShell, to open it, right-click the Start Menu and select Windows PowerShell (admin) copy and paste the code below to install the function

    function New-IsoFile

    {

    <# .Synopsis Creates a new .iso file .Description The New-IsoFile cmdlet creates a new .iso file containing content from chosen folders .Example New-IsoFile "c:\tools","c:Downloads\utils" This command creates a .iso file in $env:temp folder (default location) that contains c:\tools and c:\downloads\utils folders. The folders themselves are included at the root of the .iso image. .Example New-IsoFile -FromClipboard -Verbose Before running this command, select and copy (Ctrl-C) files/folders in Explorer first. .Example dir c:\WinPE | New-IsoFile -Path c:\temp\WinPE.iso -BootFile "${env:ProgramFiles(x86)}\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\efisys.bin" -Media DVDPLUSR -Title "WinPE" This command creates a bootable .iso file containing the content from c:\WinPE folder, but the folder itself isn't included. Boot file etfsboot.com can be found in Windows ADK. Refer to IMAPI_MEDIA_PHYSICAL_TYPE enumeration for possible media types: http://msdn.microsoft.com/en-us/library/windows...(v=vs.85).aspx .Notes NAME: New-IsoFile AUTHOR: Chris Wu LASTEDIT: 03/23/2016 14:46:50 #>

    [CmdletBinding(DefaultParameterSetName='Source')]Param(

    [parameter(Position=1,Mandatory=$true,ValueFromPipeline=$true, ParameterSetName='Source')]$Source,  
    
    [parameter(Position=2)][string]$Path = "$env:temp\$((Get-Date).ToString('yyyyMMdd-HHmmss.ffff')).iso",  
    
    [ValidateScript({Test-Path -LiteralPath $\_ -PathType Leaf})][string]$BootFile = $null, 
    
    [ValidateSet('CDR','CDRW','DVDRAM','DVDPLUSR','DVDPLUSRW','DVDPLUSR\_DUALLAYER','DVDDASHR','DVDDASHRW','DVDDASHR\_DUALLAYER','DISK','DVDPLUSRW\_DUALLAYER','BDR','BDRE')][string] $Media = 'DVDPLUSRW\_DUALLAYER', 
    
    [string]$Title = (Get-Date).ToString("yyyyMMdd-HHmmss.ffff"),  
    
    [switch]$Force, 
    
    [parameter(ParameterSetName='Clipboard')][switch]$FromClipboard 
    

    )

    Begin {

    ($cp = new-object System.CodeDom.Compiler.CompilerParameters).CompilerOptions = '/unsafe' 
    
    if (!('ISOFile' -as [type])) {  
    
      Add-Type -CompilerParameters $cp -TypeDefinition @'
    

    public class ISOFile

    {

    public unsafe static void Create(string Path, object Stream, int BlockSize, int TotalBlocks)

    {

    int bytes = 0;  
    
    byte[] buf = new byte[BlockSize];  
    
    var ptr = (System.IntPtr)(&bytes);  
    
    var o = System.IO.File.OpenWrite(Path);  
    
    var i = Stream as System.Runtime.InteropServices.ComTypes.IStream;  
    
    
    
    if (o != null) { 
    
      while (TotalBlocks-- &gt; 0) {  
    
        i.Read(buf, BlockSize, ptr); o.Write(buf, 0, bytes);  
    
      }  
    
      o.Flush(); o.Close();  
    
    } 
    

    }

    }

    '@

    } 
    
    
    
    if ($BootFile) { 
    
      if('BDR','BDRE' -contains $Media) { Write-Warning "Bootable image doesn't seem to work with media type $Media" } 
    
      ($Stream = New-Object -ComObject ADODB.Stream -Property @{Type=1}).Open()  # adFileTypeBinary 
    
      $Stream.LoadFromFile((Get-Item -LiteralPath $BootFile).Fullname) 
    
      ($Boot = New-Object -ComObject IMAPI2FS.BootOptions).AssignBootImage($Stream) 
    
    } 
    
    
    
    $MediaType = @('UNKNOWN','CDROM','CDR','CDRW','DVDROM','DVDRAM','DVDPLUSR','DVDPLUSRW','DVDPLUSR\_DUALLAYER','DVDDASHR','DVDDASHRW','DVDDASHR\_DUALLAYER','DISK','DVDPLUSRW\_DUALLAYER','HDDVDROM','HDDVDR','HDDVDRAM','BDROM','BDR','BDRE') 
    
    
    
    Write-Verbose -Message "Selected media type is $Media with value $($MediaType.IndexOf($Media))"
    
    ($Image = New-Object -com IMAPI2FS.MsftFileSystemImage -Property @{VolumeName=$Title}).ChooseImageDefaultsForMediaType($MediaType.IndexOf($Media)) 
    
    
    
    if (!($Target = New-Item -Path $Path -ItemType File -Force:$Force -ErrorAction SilentlyContinue)) { Write-Error -Message "Cannot create file $Path. Use -Force parameter to overwrite if the target file already exists."; break } 
    

    }

    Process {

    if($FromClipboard) { 
    
      if($PSVersionTable.PSVersion.Major -lt 5) { Write-Error -Message 'The -FromClipboard parameter is only supported on PowerShell v5 or higher'; break } 
    
      $Source = Get-Clipboard -Format FileDropList 
    
    } 
    
    
    
    foreach($item in $Source) { 
    
      if($item -isnot [System.IO.FileInfo] -and $item -isnot [System.IO.DirectoryInfo]) { 
    
        $item = Get-Item -LiteralPath $item
    
      } 
    
    
    
      if($item) { 
    
        Write-Verbose -Message "Adding item to the target image: $($item.FullName)"
    
        try { $Image.Root.AddTree($item.FullName, $true) } catch { Write-Error -Message ($\_.Exception.Message.Trim() + ' Try a different media type.') } 
    
      } 
    
    } 
    

    }

    End {

    if ($Boot) { $Image.BootImageOptions=$Boot }  
    
    $Result = $Image.CreateResultImage()  
    
    [ISOFile]::Create($Target.FullName,$Result.ImageStream,$Result.BlockSize,$Result.TotalBlocks) 
    
    Write-Verbose -Message "Target image ($($Target.FullName)) has been created"
    
    $Target
    

    }

    }

    Press enter to run the code and install the function.

    After installed, you can run the code below no PowerShell with your settings:

    New-Isofile (Source Folder Location) -path (Output .iso file location) -Title "(Volume Name)"

    e.g: New-Isofile C:\Program Files -path D:\Program Files Backup\Backup1.iso -Title "Backup 1 Program Files"

    The example will make a .iso file from C:\Program Files and will output the file Backup1.iso on D:\Program Files Backup folder. When mounted, the .iso file will show the volume name "Backup 1 Program Files"

    60+ people found this answer helpful.
    0 comments No comments
  2. Rodrigo Queiroz 77,250 Reputation points Independent Advisor
    2021-09-15T01:48:28+00:00

    Hi Sushruth_944,

    I'm Rodrigo and I will help you.

    Yes, you can put some folders in a ISO file, using software like the one in the link below

    http://www.softsea.com/download/Free-ISO-Creato...

    Download, install the program and run it

    Select the source folder you want to create the ISO file (all files and folders inside this folder will be on the ISO file)

    Insert the Volume Name you want

    On ISO File, choose the file output location and the file name

    Click "Create" and the ISO creation process will start

    Note: This is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.

    10+ people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2021-09-15T02:21:01+00:00

    Thanks, but is there any way I can do this with command prompt?

    5 people found this answer helpful.
    0 comments No comments
  4. Anonymous
    2021-09-15T03:29:42+00:00

    Thank you!

    4 people found this answer helpful.
    0 comments No comments