AIO script

Discussion in 'Scripting' started by Lothan88, Aug 13, 2014.

  1. Lothan88

    Lothan88 MDL Novice

    Mar 10, 2012
    23
    2
    0
    Hello, i'm deploying my new AIO for technicians and I pretend to include Windows 8.1 Installer x86 (incl. Dart), Windows 8.1 Installer x64 (incl. Dart), Dart 8.1 x86 & x64 (in systems which is not preinstalled), HBCD and maybe something else but the Windows Installation Will include oem installation script. As you can see I cannot create 2 Isos with oem programs because the size will be too big but I'm planning to make a script that search for the disk containing the oem folder and execute the installation of those programs. I'm testing this code just in case of copying a file but the result is always "0 files copied" even if the paths are right.

    for /f %D in ('wmic volume get DriveLetter^, Label ^| find "winsetup"') do xcopy %D\cat %homedrive%%D will store the letter of the drive called "Winsetup" so i want to copy the folder called cat to the C: Drive, however it says 0 files copied, i don't know why, even using administrator rights it fails. The idea is to use star /wait THESCRIPTTHAT CONTAINTSTHECODETOINSTALLMYOEMSOFTWARE.CMD (of course the name isn't too long XD) from setupcomplete.cmd

    Can anyone help me with this?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,520
    652
    60
    Have a look at Murphy78's Scripts:
    Murphy78-DiskPart-and-Apply-Image-Script
    You could modify his script for your purpose.
    For instance, once the image is applied you could copy across your software, setupcomplete, unattend.xml, etc...
    All from a bootable USB Key, 32GB Max.
     
  3. Compo

    Compo MDL Member

    Mar 29, 2011
    137
    103
    10
    #3 Compo, Aug 13, 2014
    Last edited by a moderator: Apr 20, 2017
    The following correction may help you:
    Code:
    For /F %%D In ('WMIc Volume Get DriveLetter^,Label^|Find /I "WinSetUp"') Do
    Note the additional percent symbol, (required if working from a script).

    Alternative without using WMI:
    Code:
    For /F "Delims=\ " %%A In ('MountVol^|FindStr [C-Z]:\\') Do Vol %%A 2>Nul|FindStr/IE WinSetUp>Nul&&
    Place your copy command at the end of that line
     
  4. Lothan88

    Lothan88 MDL Novice

    Mar 10, 2012
    23
    2
    0
    #4 Lothan88, Aug 13, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    It says that %%D wasn't expecting.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Compo

    Compo MDL Member

    Mar 29, 2011
    137
    103
    10
    Post the exact batch file you've just tested
     
  6. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    6,787
    10,376
    210
    ...what Flipp3r said. I shared the script with the forum so people could use it as they wanted.
    There are a lot of methods and ideas there that could help you out.
    It doesn't currently have unattend.xml or autounattend.xml support, but you could add it at any time, much the way that I added the $oem$\$$ and $oem$\$1 copy parts per index.
    The only difference is that you'd need to run a dism pass to set the xml on the newly applied index.

    It wouldn't affect the winpe parts of the xml, since it uses the diskpart and apply, but it should affect the oobe/setup portions.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Lothan88

    Lothan88 MDL Novice

    Mar 10, 2012
    23
    2
    0
    DLZMhXg.png

    I'll be out for a few hours, let see what we can do when I get back
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. Compo

    Compo MDL Member

    Mar 29, 2011
    137
    103
    10
    The clues are above!
     
  9. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    5,766
    13,248
    180
    It's a matter of mere syntax, if you are copying-pasting the script code into an open cmd prompt then use one % only, instead of two. If you are running the script, i.e. .cmd file, then use two % characters.
     
  10. s1ave77

    s1ave77 MDL Guide Dog/Dev

    Aug 15, 2012
    14,973
    19,917
    340
    #10 s1ave77, Aug 13, 2014
    Last edited by a moderator: Apr 20, 2017
    As already hinted, in command prompt the for loop should look:

    Code:
    for /f %D in ('wmic volume get DriveLetter^, Label ^| find "winsetup"') do xcopy %D %homedrive%
    in a cmd file:

    Code:
    for /f %%D in ('wmic volume get DriveLetter^, Label ^| find "winsetup"') do xcopy %%D %homedrive%
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. Compo

    Compo MDL Member

    Mar 29, 2011
    137
    103
    10
    #11 Compo, Aug 13, 2014
    Last edited by a moderator: Apr 20, 2017
    I would suggest that there is unlikely any benefit in using Start /Wait over Call This is of course only beneficial if you intend returning to the original script otherwise just use the cmd script on its own.
    Code:
    For /F "Delims=\ " %%A In ('MountVol^|FindStr [C-Z]:\\') Do Vol %%A 2>Nul|FindStr/IE WinSetUp>Nul&&"%%A\MyPathOnWinSetUp\MyScript.cmd"
     
  12. Lothan88

    Lothan88 MDL Novice

    Mar 10, 2012
    23
    2
    0
    none of this hasn't given me the results that I want, more than suggesting the code, can anybody test it? I tried with the two %% and the consele just blicks and allows me to enter another line but it doesn't copy anything.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    6,787
    10,376
    210
    If you're having trouble typing the command exactly as people are listing it, try copy/pasting it into your command prompt.
    You can do this by ctrl-c to copy and right click inside command prompt window and select paste option.
    I've looked at their syntax and it's correct to my knowledge.

    Just remember that if you are typing it yourself use one %
    If you are putting it in a script use %%
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. Lothan88

    Lothan88 MDL Novice

    Mar 10, 2012
    23
    2
    0
    #14 Lothan88, Aug 13, 2014
    Last edited: Aug 13, 2014
    (OP)
    My brother, I'm copying and even writing letter by letter, if I'm seeing that it doesn't work it is for something. I'm didn't come to this forum because I am a horse around. For me, the code looks good, however as I said CMD doesn't copy anything. Could it be that nobody renamed their flash disk to winsetup and taste it or could it be that the arrogance of knowing something leads beyond the security of showing that we are right? Should I give team viewer access to my vmware or invite you to my country to convince you of what my systems does? I like your code for the installer, you have given me new ideas but this haven solved my questing yet.


    Lets go back to my first question, I want to locate a drive called winsetup and want to copy a file called cool.txt from it to the c:/ drive. How? Of course when I posted my first example I wanted to copy the "cat" folder, now forget the cat, just copy cool.txt can anybody really test this and paste an image showing the code and the proof of that I works?

    Sorry if this is annoying but its a simple thing that won't take 5 minutes, let me share a command for our friends. Ctrl+p = print OMG!!! I prefer all of show to show me that I'm wrong and what is wrong.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. s1ave77

    s1ave77 MDL Guide Dog/Dev

    Aug 15, 2012
    14,973
    19,917
    340
    #15 s1ave77, Aug 13, 2014
    Last edited by a moderator: Apr 20, 2017
    Hmm ... works here perfectly. Created an usb device with label 'winsetup' and a dummy cool.txt on it then:

    Code:
    for /f %D in ('wmic volume get DriveLetter^, Label ^| find "winsetup"') do xcopy %D\cool.txt c:\
    Code:
    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. Alle Rechte vorbehalten.
    
    C:\Windows\System32>for /f %D in ('wmic volume get DriveLetter^, Label ^| find "
    winsetup"') do xcopy %D\cool.txt c:\
    
    C:\Windows\System32>xcopy O:\cool.txt c:\
    O:\cool.txt
    1 Datei(en) kopiert
    
    C:\Windows\System32>
    NOTE: This example is for direct usage in command prompt, inside a cmd file the runtime variable must show %%D, i.e.:

    Code:
    for /f %%D in ('wmic volume get DriveLetter^, Label ^| find "winsetup"') do xcopy %%D\cool.txt c:\
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    6,787
    10,376
    210
    Yes please, post your actual script if you want help. None of us are having the issue you are describing.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. Compo

    Compo MDL Member

    Mar 29, 2011
    137
    103
    10
    Similar to your console example, (MyScript.cmd prints the OS in square brackets):
    [​IMG]
     
  18. Lothan88

    Lothan88 MDL Novice

    Mar 10, 2012
    23
    2
    0
    My apologies to all of you, after testing many times the code I realized that for some reason the flash drive wasn't recognized as it should so I decided to format it again and rename it and that's it, it works with the code of the friend s1ave77. Danke schön. Now the next challenge is to insert dart into the Windows 8.1 installation.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...