Sign in to follow this  
Followers 0
chrisT

Run WBAdmin.exe Help

4 posts in this topic

#1 ·  Posted (edited)

Hi.. I'm trying to run WBAdmin.exe the win7/win8 backup using autoit, in both code examples below I get

C:WLD VMRC>wbadmin /?
'wbadmin' is not recognized as an internal or external command,
operable program or batch file.

However when I run simply by manually opening a cmd prompt it will work

C:Windowssystem32>wbadmin /?
wbadmin 1.0 - Backup command-line tool
© Copyright 2013 Microsoft Corporation. All rights

---- Commands Supported ----

START BACKUP              -- Runs a one-time backup....... etc.

Am I missing something here, any help appreciated, thanks

#requireadmin
Run("C:\WINDOWS\system32\cmd.exe")
WinWaitActive("C:\WINDOWS\system32\cmd.exe")
Send("wbadmin /?" &  "{ENTER}")
Exit
#requireadmin
$CMD = 'wbadmin /?'
;$CMD = 'c:\Windows\System32\wbadmin.exe /?'
;$CMD = "Ping 192.168.1.1"
RunWait('"' & @ComSpec & '" /k ' & $CMD, @SystemDir)

Exit
Edited by chrisT

Share this post


Link to post
Share on other sites

both your scripts work for me (Windows 7 32-bit). but anyway, what's wrong with direct call? add your switches to this:

RunWait("wbadmin")

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

It's because you're running a x64 Windows and your script is runnig in x86 mode.

The wbadmin.exe command is stored in c:windowssystem32, and the x86 cmd maps the @SystemDir to C:WindowsSysWOW64 folder.

If you want to access to the x64 commands from a x86 script, you can use @WindowsDir & "sysnative" instead of @SystemDir, or change the PATH environment variable before calling the command, like this

EnvSet("PATH", @WindowsDir & "\sysnative;" & EnvGet("PATH") )
RunWait('"' & @ComSpec & '" /k ' & $CMD, @SystemDir)
Edited by jguinch
1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0