' **************************
' * Declare variables here *
' **************************
' INSTRUCTIONS: This sample code will require that the Windows ADK be installed in the default location. Note that only
' the "Deployment Tools" option from the ADK needs to be installed.
'
' Modify the variables below as follows:
'
' SourcePath$ - Point to a location containing files that you want to place into an ISO image. Any files will do.
' DestinationPathAndFileName$ - This is the full path and filename of the ISO image that is to be created.
' VolumeName$ - This is the Volume Name that will be displayed when the ISO image is mounted in Windows or on the
' media when burned. An empty string is valid and denotes no volume name or label.
' Initialize variables. Note that in my real code, these variables are populated from various other pieces
' of information. I'm simply plugging in sample values here to demostrate the issue.
SourcePath$ = "D:\My folder with test data"
DestinationPathAndFileName$ = "D:\Test File.iso"
VolumeName$ = "This is the image vol name"
' Build the command that needs to be run to create the ISO image.
Cmd$
= CHR$(34) + "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\oscdimg.exe" + CHR$(34) + " " + "-o -m -h -k -u2 -udfver102 -l" + CHR$(34) + VolumeName$
+ CHR$(34) + " " + CHR$(34) + SourcePath$
+ CHR$(34) + " " + CHR$(34) + DestinationPathAndFileName$
+ CHR$(34)
PRINT "Command to be run:"
' The line following these comments is what actually executes the command and fails.
PRINT "We are pausing at this point so that the output can be viewed. We will then continue" PRINT "after the user presses any key."
' Next, note that we are taking the exact same command contained in Cmd$ and putting it in a batch file.
' We then execute that batch file. This exact same command executes successfully now.
PRINT "Once again, we pause so that the user can view the output and continue after the user presses any key."
' We no longer need the batch file that was created above, so we are now deleting it