Jump to content

@ScriptDir help


Go to solution Solved by trashy,

Recommended Posts

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?

Link to comment
Share on other sites

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 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."

Link to comment
Share on other sites

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 by Graeme
Link to comment
Share on other sites

  • Moderators

@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!

Link to comment
Share on other sites

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 by trashy
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...