Shadow_Delta

How to add Path into a CMD command?

6 posts in this topic

HI,
   Right into the issue, I want to add and obtained path into a cmd command using a variable or any thing which works.
The concept is to Obtain a file using  $sPath = FileOpenDialog and giving the whole path including the file name and extension.

 

Case $Button1
            $sPath = FileOpenDialog("Open a file", @desktopdir, "All file (*.*)")
            GUICtrlSetData($Button1, $sPath)

         Case $Button2
            $CMD = 'ccs.exe /line /pack /PackPath:[Obtained Path Here]
            RunWait('"' & @ComSpec & '" /k ' & $CMD, @SystemDir, @SW_SHOW)

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

closer?

$CMD = 'ccs.exe /line /pack /PackPath:' & $sPath
RunWait(@ComSpec & ' /k ' & $CMD, @SystemDir, @SW_SHOW)

 

or if you need to wrap that path in quotes due to spaces

$CMD = 'ccs.exe /line /pack /PackPath:' & '"' & $sPath & '"'
RunWait(@ComSpec & ' /k ' & $CMD, @SystemDir, @SW_SHOW)

 

Edited by boththose
1 person likes this

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

closer?

$CMD = 'ccs.exe /line /pack /PackPath:' & $sPath
RunWait(@ComSpec & ' /k ' & $CMD, @SystemDir, @SW_SHOW)

 

That was easy,  I was trying with '& $sPath' seems like the ' ' Was the problem.

and it Works! Thank you. :):D

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

How can i execute the code one after another after multiple files have been selected?
and a possible way to show the progress within the window as in like this. using my cmd code above?
I'm Using Koda for the GUI purpose.

untitled2.PNG

Edited by Shadow_Delta
Multiselect Done

Share this post


Link to post
Share on other sites

https://www.autoitscript.com/autoit3/docs/functions/FileOpenDialog.htm

 $FD_MULTISELECT (4) = Allow MultiSelect

 

and what is the output in the console when you run the ccs.exe command?  does it show progress?


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

https://www.autoitscript.com/autoit3/docs/functions/FileOpenDialog.htm

 

and what is the output in the console when you run the ccs.exe command?  does it show progress?

I have set multi select, Yes, it's actually a small program to install cab files using DISM.exe.
I want to set a box in which the progress will be shown.

and possibly to make sure that the multiple files gets processed one after another. :)

Case $Button1
            $sPath = FileOpenDialog("Open a file", @desktopdir, "Cabinet Files (*.cab)",$FD_MULTISELECT)
            GUICtrlSetData($Button1, $sPath)

         Case $Button2
            $CMD = 'DISM.exe /Online /Add-Package /PackagePath:' & $sPath
         RunWait('"' & @ComSpec & '" /k ' & $CMD, @SystemDir, @SW_SHOW)

 

Win.PNG

Edited by Shadow_Delta

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