cmd to script?

Discuss and share scripts and script files...
yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

cmd to script?

Post by yusef88 »

start firefox.exe -Profile "afox/"

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: cmd to script?

Post by yusef88 »

Possible to make command prompt figure out what's the drive letter of portable xyplorer folder?
cmd /K "cd /d ?:\xy portable\"
goto get("driveletter", "data", "?:\xy portable\"); //soft drive letter

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

Re: cmd to script?

Post by highend »

<xydrive>

Help - Advanced Topics - Variables...
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: cmd to script?

Post by yusef88 »

thanks for replay highend
I run xyplorer and firefox in portable mode and use this command to run firefox

Code: Select all

<xypath>\afox.bat
the batch contain this

Code: Select all

start firefox.exe -Profile "afox/"
is there any possibility to start firefox directly by script? soft drive letter can do any trick in my case?

Code: Select all

get("driveletter", "data", "?:\xy portable\"); //soft drive letter
To see the attached files, you need to log into the forum.

binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: cmd to script?

Post by binocular222 »

Code: Select all

Run """C:\Program Files\firefox.exe"" -Profile afox/"
Note that any switch with space must have double quote
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: cmd to script?

Post by yusef88 »

binocular222 wrote:

Code: Select all

Run """C:\Program Files\firefox.exe"" -Profile afox/"
Note that any switch with space must have double quote
what will happen it creates a new folder named afox in C:\Program Files\firefox directory, i want run my firefox profile as a relative path, in any case it is not so that important it works by batch and it's ok. just curious to know if XY could do it :) ,thanks binocular222

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

Re: cmd to script?

Post by highend »

Where exactly does this profile folder exist? Show the complete folder hierarchy.
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: cmd to script?

Post by yusef88 »

on thumb drive and it's letter manged by windows so it changes every time i plug it
something like that H:\xy-portable\afox\ batch file must be placed in the root folder that contains the firefox profile to start correctly

Code: Select all

H:\xy-portable\afox\
<xypath>\afox\
do you get me? :)

binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: cmd to script?

Post by binocular222 »

If you run XY from that USB, then <xypath> is already portable (not depend of drive letter)
i.e: Paste this in address bar and press enter:
::echo <xypath>

If you want to get the drive letter that XYplorer is running on, then use a question mark ? i.e:
Run """C:\Program Files\firefox.exe"" -Profile ""?\Somefolder\afox/"" "

If you don't run XY on that USB, then use this:

Code: Select all

 $USBdrive = trim(get("drives", 2), '\');;
 Run """C:\Program Files\firefox.exe"" -Profile ""$USBdrive\Somefolder\afox/"" "
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: cmd to script?

Post by yusef88 »

wow it's working exactly as I want. binocular222 many thanks to you :D

Code: Select all

 $USBdrive = trim(get("drives", 2), '\');;
 Run """%programfiles%\Mozilla Firefox\firefox.exe"" -Profile ""$USBdrive\xy-portable\afox/"" "
let's say i have another usb plugged before so it will use it instead the one i work with it

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

Re: cmd to script?

Post by highend »

First usb drive with that folder wins...

Code: Select all

    $folderName = "xy-portable";
    $usbDrives = replace(get("drives", 2), "\", "");
    foreach($drive, $usbDrives, "|") {
        if (exists("$drive\$folderName") == 2) {
            run """%programfiles%\Mozilla Firefox\firefox.exe"" -Profile ""$drive\$folderName\afox/""";
            break;
        }
    }
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: cmd to script?

Post by yusef88 »

highend wrote:First usb drive with that folder wins...

Code: Select all

    $folderName = "xy-portable";
    $usbDrives = replace(get("drives", 2), "\", "");
    foreach($drive, $usbDrives, "|") {
        if (exists("$drive\$folderName") == 2) {
            run """%programfiles%\Mozilla Firefox\firefox.exe"" -Profile ""$drive\$folderName\afox/""";
            break;
        }
    }
what I like in your script that "xy-portable" folder must be exists first and doesn't create new one if it's not, so I guarantee don't leave any traces in mistake area. very thanks highend :D

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: cmd to script?

Post by yusef88 »

Code: Select all

"cmd" /k "C:\Program Files\dcrypt\dccon.exe" -mountall
in user defined commands it works but how to run it directly by script

binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: cmd to script?

Post by binocular222 »

Run "cmd /k ""C:\Program Files\dcrypt\dccon.exe"" -mountall"
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: cmd to script?

Post by yusef88 »

binocular222, you're the best :D
=======
to whom it may concern

Code: Select all

Run """%programfiles%\Mozilla Firefox\firefox.exe"" -Profile ""<xypath>\afox/"" "
works standalone very well

Post Reply