Sign in to follow this  
Followers 0
miker95

Problems Running Command Prompt

7 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

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

000


Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

take a look >to this solution


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Forgot to give an update on this. Compiling in 64-bit mode did work, so did running it from SysWOW64! Thanks, can't believe none of us thought of it.

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