Jump to content

Problems Running Command Prompt


miker95
 Share

Go to solution Solved by Jos,

Recommended Posts

Hello, I work for a comptuer shop and we are using AutoIT to perform daily tasks.We are currently writing a script to run at the start of our custom Win8 PE. This script will run chkdsk and defrag on every drive that is not drive B: or drive X:, as those are the ones used to run the PE. Writing out that part is no problem, we have that completely functional.

The problem we are encountering is that when we open a command prompt in AutoIT using Run("X:WindowsSystem32cmd.exe") and we run the command dir *.exe it will return a different amount of files than if we run that same command in a prompt not opened by AutoIT. When the computer is in PE and we try to run RunWait("X:WindowsSystem32cmd /c chkdsk " & $drive_letter & " /f") we will get a 'chkdsk' is not a valid command' and we get this because in the AutoIT cmd window chkdsk.exe does not shop up on the dir *.exe list.

Even in regular Windows the AutoIT command prompt returns a different amount of items, but it has chkdsk.exe on the list. Has anyone encountered this problem? Anyway to get around it?

We have tried ShellExecute, RunAs(), and creating a batch file and the running it and that doesn't work.

swnm.jpg

Edited by miker95
Link to comment
Share on other sites

  • Developers
  • Solution

Check if you are running x64 and compare with the dir result of "c:windowssyswow64".

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Oh man, they're the same from the one running from AutoIT and not from AutoIT.

I don't have the PE on me right now so I won't be able to test it for a while but if that's the solution then I feel pretty silly...

I'll give an update on whether or not it works in PE, thanks a bunch though.

Link to comment
Share on other sites

are you try like this?????????

$CMD3 ="chkdsk" ;Type here your command
$picPro2=RunWait('"'&@ComSpec&'"/c'&$CMD3,@SystemDir)

000

Yes, we tried that as well which I forgot to mention, and that did not work either. We still got the 'chkdsk' is not a valid command error message.

 

This is our first 64-bit PE, the others have been 32-bit so I'm fairly certain that compiling it for 64-bit and calling System32chkdsk will do the trick or calling SysWOW64chkdsk under a compiled 32-bit exe, we just didn't think of it that way.

Edited by miker95
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...