for command with diskpart

nappy_d
nappy_d used Ask the Experts™
on
Hi all I need some help getting this command to work but I keep getting an error "@echo" command not found

@echo off
for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%p:\utils\ set w=%%p "diskpart /s %w%:\utils\utils\diskpartcmds.txt"
 
for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%p:\utils\ set w=%%p start %w%:\utils\IMAGEX.bat
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Gerwin Jansen, EE MVETopic Advisor
Most Valuable Expert 2016

Commented:
Can you have a look in IMAGEX.bat if there is an echo command in there?

When debugging this, I would leave out or uncomment @echo and start the batch file from a cmd window. That way you can see where the error originates. Since you're having multiple commands after the if statements, you should use ( )

Like this:
REM @echo off
for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%p:\utils\ (
  set w=%%p
  diskpart /s %w%:\utils\utils\diskpartcmds.txt
)
 
for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%p:\utils\ (
  set w=%%p
  start %w%:\utils\IMAGEX.bat
)

Open in new window

nappy_dThere are a 1000 ways to skin the technology cat.

Author

Commented:
I was then attempting to call this in the next batch script.  Again, I probably screwed it up :)

imagex.exe /apply @echo off for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%p:\utils\ set w=%%p %w%:\utils\pod1200.wim 1 c:
exit

Open in new window

Gerwin Jansen, EE MVETopic Advisor
Most Valuable Expert 2016

Commented:
imagex.exe /apply
@echo off for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%p:\utils\ (
 set w=%%p
  %w%:\utils\pod1200.wim 1 c:
)
exit /b


(note the /b - this will return to your previous cmd file)
11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

nappy_dThere are a 1000 ways to skin the technology cat.

Author

Commented:
Thanks.  Let me give these a test run tonite...
Gerwin Jansen, EE MVETopic Advisor
Most Valuable Expert 2016

Commented:
Ok, just saw I missed 1 'return':

imagex.exe /apply
@echo off
for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%p:\utils\ (
  set w=%%p
  %w%:\utils\pod1200.wim 1 c:
)
exit /b
nappy_dThere are a 1000 ways to skin the technology cat.

Author

Commented:
hmm this isn't quite working from this post http:#37855623

I made a couple of changes and this did the trick...

for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do             
             if exist %%p:\utils\ (
  set w=%%p
  imagex.exe /apply %w%:\utils\8808.wim 1 c:
  )
)
Topic Advisor
Most Valuable Expert 2016
Commented:
Ok, just that your last post is missing a ( after "do":

for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do (      
             if exist %%p:\utils\ (
  set w=%%p
  imagex.exe /apply %w%:\utils\8808.wim 1 c:
  )
)

Then it's working :)
nappy_dThere are a 1000 ways to skin the technology cat.

Author

Commented:
Just thought I would share this with you on how to complete a full Win7 USB ke after I corrected my commands with your help.  :)

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/A_10149-Making-the-ultimate-Windows-7-boot-disk.html
Gerwin Jansen, EE MVETopic Advisor
Most Valuable Expert 2016

Commented:
Thanks :-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial