Jump to content
Sign in to follow this  
trashy

@ScriptDir help

Recommended Posts

trashy

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
Starstar

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
trashy

No luck with

$aRun = Run(@ComSpec & " /c @WorkingDir, Dism.exe .......

If I'm doing this right

Share this post


Link to post
Share on other sites
AdamUL

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

Share this post


Link to post
Share on other sites
trashy

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
AdamUL

Where is @ScriptDir located?  Are you running the script as 32-bit or 64-bit?  

 

Adam

Share this post


Link to post
Share on other sites
trashy

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
Graeme

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
JLogan3o13

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

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Graeme

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
trashy

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.