Running command with parameters from script does not work.

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
thurines
Posts: 4
Joined: 05 May 2020 11:27

Running command with parameters from script does not work.

Post by thurines »

Hi

I wanted to create a simple scripts that run a command line tool from within XYplorer with some parameters, but I can't get it to work. This is the command I am running

::run """C:\Users\exampleuser\AppData\Local\Programs\Python\Python38\Scripts\bpsproxy.exe"" -s 50 100 -p nvenc ""<curpath>""";

Essentially I want to run this program that creates proxies for video editing with some parameters and a file path parameter at the end. However running this from the address bar, just opens and closes cmd with no additional feedback.

The goal is to have a shortcut in a catalog so that I can just browse to a folder and click it to have this command line program generate proxies for all video files in the folder.

This is the command from the manual I am trying to replicate:

run """C:\Program Files (x86)\WinMerge\WinMergeU.exe"" /e /r ""<get path 1>"" ""<get path 2>""";

By swapping out the filepath to the tool, the parameters and the paths. I thought it would work. Running the command from cmd or through Run works fine.

Thanks for any help!

/Erik

highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Running command with parameters from script does not work.

Post by highend »

Show a screenshot where you execute it with multiple -s values from a command prompt (I want to see the full command AND that it begins to create the proxies)
One of my scripts helped you out? Please donate via Paypal

thurines
Posts: 4
Joined: 05 May 2020 11:27

Re: Running command with parameters from script does not work.

Post by thurines »

Hi, this is how I run the command manually. I guess that it is something simple but since the command line window just pops open and disappears I can't find out what the problem is. Is there a way to make the command line persist?
2020_05_05_13_15_15_urEES.png
Edit: I also tested the command manually by adding quotes around both filepaths and I tested with only one parameter for the -s flag.

Here is another example of my test using "try script" with this single line:

::run """C:\Users\Katten\AppData\Local\Programs\Python\Python38\Scripts\bpsproxy.exe"" -s 50 -p nvenc ""<curpath>""",<curpath>,1,1;
2020_05_05_13_35_18_bVIPn.png
To see the attached files, you need to log into the forum.

highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Running command with parameters from script does not work.

Post by highend »

I can run this without problems:

Code: Select all

run """C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python38\Scripts\bpsproxy.exe"" -s 50 -p nvenc ""<curpath>""";
But if I try to use more than one parameter for -s I get this:
» Checking for existing proxies...
ERROR:BPS:No closing quotation
~ Exiting.

Do this to see what's going wrong on your side:

Code: Select all

    $cmd = <<<>>>
""C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python38\Scripts\bpsproxy.exe" -s 50 -p nvenc "<curpath>""
>>>;
    run """cmd"" /k $cmd";
I'm using this construct to not get into quoting hell^^
One of my scripts helped you out? Please donate via Paypal

thurines
Posts: 4
Joined: 05 May 2020 11:27

Re: Running command with parameters from script does not work.

Post by thurines »

Hi

Thanks a lot for your help. I manage to solve it. I had to right click XYPlorer and "run as administrator" once. After that I could close XYPlorer, restart the computer and run XYPlorer normally again. Then I could run the script even with the double parameter for the -s flag. I guess that there were some permissions XYPlorer could not setup without having these admin permissions on at least one start.

Thanks again!

/Erik

highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Running command with parameters from script does not work.

Post by highend »

I doubt that this is / was a permission thing.

The only thing that can interfere is if XY was running while you've setup e.g. the path environment (e.g. installing python itself or adding the ffmpeg folder to the path) because XY can't catch this change without being restarted. The result is, that any command prompt / or any tool that is started by XYplorer! and requires to know about the environment variables (like %path% - that's the case here, bsproxy needs to know where the ffmpeg files are) does only know about the old environment, not the updated one while Win + R or a command prompt (NOT started via XY) do know about the changed (%path%) enviroment...

Regardless of that, it's solved. In the end that's what matters...
One of my scripts helped you out? Please donate via Paypal

thurines
Posts: 4
Joined: 05 May 2020 11:27

Re: Running command with parameters from script does not work.

Post by thurines »

Thanks for the insight. That could very well be the case since I think ffmpeg was added to the path while XYPlorer was open.

Post Reply