locked
Batch script for changing .wim name while capturing in Win PE RRS feed

  • Question

  • Hey my fellow techs!

    Here is my dilemma.  Every time I capture an image in Win PE i have to open notepad to change the wim file name and the "Name" name.  What i would like to do is have a variable set to be able to prompt me with "What would you like to change your wim file name to?"  and then have it rename it to whatever I just typed.  #1 is the syntax without any variables  #2 is my attempt.

    Please help in anyway you can.  Thanks!

    Here is my code:

    1. Dism /Capture-Image /ImageFile:n:\sysprepserver.wim /CaptureDir:W:\ /Name:"Sysprep2012"

    2.

    SET /P N=[Name your wim file]
    @echo off 
    echo "Please enter your wim file name" 
    echo "Name:" 
    set /p Name=

    Dism /Capture-Image /ImageFile:n:\%Name%.wim /CaptureDir:W:\ /Name:"%Name%"
    Thursday, November 3, 2016 1:41 AM

Answers

  • If you are only interested in how to pass values to a batch then do this:

    @echo off 

    Dism /Capture-Image /ImageFile:n:\%1.wim /CaptureDir:W:\ /Name:"%1"

    call the batch like this:

    mybatch wimname

    %1 - % 9 are arguments to the batch.


    \_(ツ)_/

    • Marked as answer by Nate Knight Thursday, November 3, 2016 3:42 AM
    Thursday, November 3, 2016 3:37 AM

All replies

  • This question should be asked i the deployment forum.  It is not a scripting question.

    \_(ツ)_/

    Thursday, November 3, 2016 2:05 AM
  • If you are only interested in how to pass values to a batch then do this:

    @echo off 

    Dism /Capture-Image /ImageFile:n:\%1.wim /CaptureDir:W:\ /Name:"%1"

    call the batch like this:

    mybatch wimname

    %1 - % 9 are arguments to the batch.


    \_(ツ)_/

    • Marked as answer by Nate Knight Thursday, November 3, 2016 3:42 AM
    Thursday, November 3, 2016 3:37 AM
  • Hmmm so will this prompt the user to enter something in the %1?
    Thursday, November 3, 2016 3:40 AM
  • No.

    At a command prompt type "prompt /?" to see how to prompt for input.


    \_(ツ)_/

    Thursday, November 3, 2016 3:42 AM
  • Thanks! 
    Thursday, November 3, 2016 3:43 AM