Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm tring to create some directories (dirs) using a .bat file. At the cmd.exe, I can create the dirs normally, but when runing the commands inside a .bat file, for some odd reason, the dirs are created inside the SysWOW64 directory.

Win 7 x64 SP1 PRO

How can I tell Windows to create the dirs at the correct path?

Commands:

mkdir C:\Windows\System32\oobe\info
mkdir C:\Windows\System32\oobe\info\backgrounds

Inside bat, results in: C:\Windows\SysWOW64\System32\oobe\info


Using a shortcut to cmd.exe and running it as administrator the dirs are still created inside SysWOW64. ex:

%windir%\system32\cmd.exe /c "D:\Test.bat"
 or
%windir%\System32\runas.exe /user:Administrator %windir%\system32\cmd.exe /c "D:\Test.bat"

but if a open the cmd.exe manually as administrator and run the .bat file, it works! What a heck??


edit 2

I found out why. It is because I was running the .bat inside XYPlorer and not Windows Explorer (WE). Inside WE the .bat works. But a shortcut opened inside a 32 bit explorer is not able to run a 62 bit cmd.exe ?

share|improve this question
1  
Open a run window, type in c:\windows\system32\cmd.exe and run your script from there. Does the script work as it should then? What if you run c:\windows\syswow64\cmd.exe and then run the script? –  JSanchez Feb 25 at 18:52
    
How can I make a bat do that? –  Pedro77 Feb 25 at 19:14
    
Use this command: c:\windows\system32\cmd.exe /c "name of your script" If this works, I can write an answer that will (hopefully) make your script launch the 64-bit command interpreter itself. Unfortunately, I don't have a 64-bit version of Windows on my computer to test this. –  JSanchez Feb 25 at 19:42
    
Just tried it on my system and I don't get the same behaviour... c:\windows\system32\cmd.exe /c "name of your script" is what my bat has for command line, so that should be it. –  emm980 Feb 26 at 4:42
    
run the 64Bit CMD.exe, not the 32Bit one. –  magicandre1981 Feb 26 at 5:14

1 Answer 1

The SysWOW64 is a feature in windows system folder structures and in windows registry. But this feature causes major problems for automation. Here's some info about the SysWOW emulator: http://msdn.microsoft.com/en-us/library/aa384249(VS.85).aspx

To work around this issue you need to either launch a 64bit version on command prompt or use MS's folder redirection.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.