trashy Posted April 2, 2014 Posted April 2, 2014 I'm trying to replace file path with @ScriptDir with no luck. Replace $aRun = Run(@ComSpec & " /c C:dism8Dism.exe /Get-ImageInfo /ImageFile:""" & GUICtrlRead($T1Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) With $aRun = Run(@ComSpec & " /c @ScriptDir, Dism.exe /Get-ImageInfo /ImageFile:""" & GUICtrlRead($T1Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) What am I doing wrong?
Starstar Posted April 2, 2014 Posted April 2, 2014 (edited) Use >>>>>>>>>>>>"@WorkingDir" if you want to pick another file path instead script from active path.......if you want to pick up script then use "@ScriptFullPath"(Equivalent to @ScriptDir & "" & @ScriptName). @WorkingDir ;For Current/active working directory. Only includes a trailing backslash when the script is located in the root of a drive. Edited April 2, 2014 by Starstar Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."
trashy Posted April 2, 2014 Author Posted April 2, 2014 No luck with $aRun = Run(@ComSpec & " /c @WorkingDir, Dism.exe ....... If I'm doing this right
AdamUL Posted April 2, 2014 Posted April 2, 2014 Are you trying to run Dism.exe from the @ScriptDir? If so, try this. $aRun = Run(@ComSpec & ' /c "' & @ScriptDir & '\Dism.exe" /Get-ImageInfo /ImageFile:"' & GUICtrlRead($T1Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Adam
trashy Posted April 2, 2014 Author Posted April 2, 2014 Yes Adam I'm trying to run Dism for win 8 on a win 7 machine. I've already tried that one too, the only way I can make it work is using full file path.
AdamUL Posted April 2, 2014 Posted April 2, 2014 Where is @ScriptDir located? Are you running the script as 32-bit or 64-bit? Adam
trashy Posted April 2, 2014 Author Posted April 2, 2014 C:dism8 and 32 bit script. Only other solution I can think of would be EnvGet("SYSTEMDRIVE") and specify a dir. Not really what I wanted but should work.
Graeme Posted April 2, 2014 Posted April 2, 2014 (edited) Trashy, It looks to me like you need to replace "C:dism8Dism.exe" with @scriptdir & "Dism.exe" - not @scriptdir, dism.exe. The comma is the problem. You need to make @scriptdir a variable not part of the text.. Clear? Adam put : $aRun = Run(@ComSpec & ' /c "' & @ScriptDir & '\Dism.exe" /Get-ImageInfo /ImageFile:"' & GUICtrlRead($T1Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) and you put: $aRun = Run(@ComSpec & " /c @WorkingDir, Dism.exe" /Get-ImageInfo /ImageFile:"' & GUICtrlRead($T1Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Or did you put $aRun = Run(@ComSpec & " /c @WorkingDir, Dism.exe /Get-ImageInfo /ImageFile:"' & GUICtrlRead($T1Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Hope that helps. Commas and speakmarks are so tricky!! Blessings Graeme Edited April 2, 2014 by Graeme
Moderators JLogan3o13 Posted April 2, 2014 Moderators Posted April 2, 2014 @Graeme, If you read up, you will find that this was suggested in post #4, and the OP stated it is not working. @OP, have you tried just unhiding the window, to ensure it is printing out the way you expect? $aRun = Run(@ComSpec & ' /k "' & @ScriptDir & '\Dism.exe" /Get-ImageInfo /ImageFile:"' & GUICtrlRead($T1Input1), "", @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD) "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Graeme Posted April 2, 2014 Posted April 2, 2014 Hi John, If you read very carefully you will see the point I was trying to make... Blessings Graeme
trashy Posted April 2, 2014 Author Posted April 2, 2014 (edited) Tried without trying to catch the output $aRun = Run(@ComSpec & ' /k "' & @WorkingDir & '\Dism.exe" /Get-ImageInfo /ImageFile:"' & GUICtrlRead($T1Input1)) It's not even calling dism The filename, directory name, or volume label syntax is incorrect I've tried every variation I could think of, as a variable and as a cmd and double quotes. Use EnvGet and basically specifying the full file path is the only thing that works. $aRun = Run(@ComSpec & " /k " & EnvGet("SYSTEMDRIVE") & "\dism8\Dism.exe /Get-ImageInfo /ImageFile:" & GUICtrlRead($T1Input1)) Edited April 2, 2014 by trashy
Solution trashy Posted April 2, 2014 Author Solution Posted April 2, 2014 I just got it one quote out of place after dism.exe aRun = Run(@ComSpec & ' /k "' & @ScriptDir & '\Dism.exe /Get-ImageInfo /ImageFile:"' & GUICtrlRead($T1Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now