Jump to content
Sign in to follow this  
trashy

@ScriptDir help

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?

Share this post


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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi John,

If you read very carefully you will see the point I was trying to make...:)

Blessings

Graeme

Share this post


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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...