INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Can I use "Send To (external) to open a DOS Window?  (Read 1039 times)

elprice7345

  • Galactic Citizen
  • ****
  • Posts: 254
Can I use "Send To (external) to open a DOS Window?
« on: August 13, 2021, 03:10:41 pm »

I've found the "Send To (external)" feature to be quite useful!  :)

I've created links to external programs like MediaInfo, Subtitle Edit, and MKVToolNix that work great.

I would like to create another external link that would open a DOS window to the folder the file is in when I right-click the file in MC. I would then be able to process files in the specified folder with batch files and other commands.

Can anyone help?
Logged

Outlaw Audio

  • Junior Woodchuck
  • **
  • Posts: 69
  • Dogs......because people suck
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #1 on: August 13, 2021, 04:35:25 pm »

I've found the "Send To (external)" feature to be quite useful!  :)

I've created links to external programs like MediaInfo, Subtitle Edit, and MKVToolNix that work great.

I would like to create another external link that would open a DOS window to the folder the file is in when I right-click the file in MC. I would then be able to process files in the specified folder with batch files and other commands.

Can anyone help?

I'm using ComEmu as my command shell.  If your using another shell, the exact commands will be different but this is what I use in the SendTo configuration

Logged

Outlaw Audio

  • Junior Woodchuck
  • **
  • Posts: 69
  • Dogs......because people suck
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #2 on: August 13, 2021, 05:09:32 pm »

The following works for PowerShell
Logged

elprice7345

  • Galactic Citizen
  • ****
  • Posts: 254
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #3 on: August 15, 2021, 02:34:16 pm »

Thanks @Outlaw Audio!

Your PowerShell option works perfectly!

You've answered my original question, but for my own edification is there a DOS equivalent to your PowerShell answer?
Logged

Outlaw Audio

  • Junior Woodchuck
  • **
  • Posts: 69
  • Dogs......because people suck
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #4 on: August 15, 2021, 08:25:16 pm »

I'm assuming your wanting to use command.com as the DOS shell?  If so, I can't help you there as my version of Windows doesn't have a 64bit command interpreter except for Power Shell and Com Emu.  "cmd" is still available but is a 32 bit version and will not respond to UNC path's which renders it useless for network drives or NAS setups.  Therefore, I have nothing to experiment with.  I suspect the command line would be something like: 

C:\WINDOWS\SYSTEM32\COMMAND.COM  [Filename (path)]  or
C:\WINDOWS\SYSTEM32\COMMAND.COM /K CHDIR [Filename (path)]

but I can't verify, sorry.  Perhaps one of the other users has some thoughts?
Logged

elprice7345

  • Galactic Citizen
  • ****
  • Posts: 254
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #5 on: August 15, 2021, 09:12:32 pm »

Thanks for the answer @Outlaw_Audio, but I'm still unable to get it to work.

If I open a command prompt and type the following, it takes me to the specified path.
Code: [Select]
cd /d "d:\ed\temp"
But, I can't figure out the correct syntax (assuming it's possible) to pass the [Filename (path)] field to the command prompt.

Many thanks for your help!  :)

I'll use the PowerShell version unless someone else can help.
Logged

David Sydney

  • Galactic Citizen
  • ****
  • Posts: 377
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #6 on: August 16, 2021, 03:11:33 am »

You could create a old msdos batch file that opens cmd, then change the folder to the one you are after. BAT files still work. Pass the batch file to be exectuted in the send to dialog. Probably could achieve through setting and environmental variable also... just a thought I have not tried to set it up myself but know WinDos there would be a way.....
Logged
Dave
------
Linux Manjaro 24 / Windows 10 Pro | i7 14700K Gigabyte Z790 UD AX | JRMark 10253 | Realtek Integrated HDAudio SPDIF | PC Sound = 1/ Yamaha TSS-15 5.1 Speaker System, 2/ SMSL SU-1 DAC + TA-66 Tube Headphone Amp + Klipsch ProMedia Heritage 2.1 Speakers | HiFi Sound = 1/ Network DLNA to WiiM Ultra Streamer + Advaned Paris A10 Amp in Music Room, 2/ DLNA to Yamaha RX-V777 AV Receiver in Living Room & Outside Deck, 3/ DLNA to Paired Yamaha WiFi WX-010 MusicCast Speakers to Outside Areas

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2618
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #7 on: August 16, 2021, 05:25:47 am »

This works for local paths:

program path: cmd.exe
parameters: /k cd /d "[Filename (path)]"

Note that cmd.exe cannot chdir to network paths, so this only works if your files are in local drives or mounted network drives (with a drive letter). Powershell doesn't have that limitation.
Logged

elprice7345

  • Galactic Citizen
  • ****
  • Posts: 254
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #8 on: August 16, 2021, 04:10:33 pm »

This works for local paths:

program path: cmd.exe
parameters: /k cd /d "[Filename (path)]"

Note that cmd.exe cannot chdir to network paths, so this only works if your files are in local drives or mounted network drives (with a drive letter). Powershell doesn't have that limitation.
Thanks for the help @zybex, but it doesn't work for me. That was one of the many syntax options I tried.

I get a DOS window that opens to C:\Windows\System32.

I'm still curious about getting the DOS option to work, but it sounds like Powershell is a more powerful tool to use. I just haven't spent any time learning it. Maybe it's time to start?  ;)
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2618
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #9 on: August 16, 2021, 04:17:03 pm »

It is the correct syntax. You can test it with Windows->Run (WIN+R) and write there "cmd /k cd /d c:\"

Is the path to your files on a NAS/Network drive? As I mentioned above, that won't work.
Is there an error message displayed above the "C:\Windows\System32>" prompt?
Logged

elprice7345

  • Galactic Citizen
  • ****
  • Posts: 254
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #10 on: August 16, 2021, 05:15:01 pm »

The syntax you provided works for me when run from WIN+R, but not in MC.

I'm trying to access a local drive.

It opens a DOS window to C:\Windows\System32 with no errors.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2618
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #11 on: August 16, 2021, 05:54:53 pm »

What is the [Filename (path)] value of the file you're testing?
Logged

elprice7345

  • Galactic Citizen
  • ****
  • Posts: 254
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #12 on: August 16, 2021, 09:16:28 pm »

When I type "cmd /k cd /d K:\Download\" at WIN+R it opens a DOS window correctly to the proper path.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2618
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #13 on: August 17, 2021, 02:27:49 am »

Nevermind, I'm an idiot. I forgot fwd-slashes need to be escaped here as well! Try:

program path: cmd.exe
parameters: //k cd //d "[Filename (path)]"
Logged

Outlaw Audio

  • Junior Woodchuck
  • **
  • Posts: 69
  • Dogs......because people suck
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #14 on: August 17, 2021, 12:57:50 pm »

here are the switches for CMD for use in the 32 bit context:

Starts a new instance of the Windows XP command interpreter

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
    [[/S] [/C | /K] string]

/C      Carries out the command specified by string and then terminates
/K      Carries out the command specified by string but remains
/S      Modifies the treatment of string after /C or /K (see below)
/Q      Turns echo off
/D      Disable execution of AutoRun commands from registry (see below)
/A      Causes the output of internal commands to a pipe or file to be ANSI
/U      Causes the output of internal commands to a pipe or file to be
        Unicode
/T:fg   Sets the foreground/background colors (see COLOR /? for more info)
/E:ON   Enable command extensions (see below)
/E:OFF  Disable command extensions (see below)
/F:ON   Enable file and directory name completion characters (see below)
/F:OFF  Disable file and directory name completion characters (see below)
/V:ON   Enable delayed environment variable expansion using ! as the
        delimiter. For example, /V:ON would allow !var! to expand the
        variable var at execution time.  The var syntax expands variables
        at input time, which is quite a different thing when inside of a FOR
        loop.
/V:OFF  Disable delayed environment expansion.
Note that multiple commands separated by the command separator '&&'
are accepted for string if surrounded by quotes.  Also, for compatibility
reasons, /X is the same as /E:ON, /Y is the same as /E:OFF and /R is the
same as /C.  Any other switches are ignored.

If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:

    1.  If all of the following conditions are met, then quote characters
        on the command line are preserved:

        - no /S switch
        - exactly two quote characters
        - no special characters between the two quote characters,
          where special is one of: &<>()@^|
        - there are one or more whitespace characters between the
          two quote characters
        - the string between the two quote characters is the name
          of an executable file.

    2.  Otherwise, old behavior is to see if the first character is
        a quote character and if so, strip the leading character and
        remove the last quote character on the command line, preserving
        any text after the last quote character.

If /D was NOT specified on the command line, then when CMD.EXE starts, it
looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if
either or both are present, they are executed first.


Therefore the //d is not executed as a command switch.  The command will run without the //d but is still limited to accessing only local drives and directory locations.  None of these will work with UNC paths.  However, there is one command that will work, but its ugly and Ive not played around with it much, its popd.  It will essentially share the UNC location, giving it a local drive path so CD or CHDIR can access it.  However, you must issue a popd to release the networked drive share unless you want a plethora of drive shares at the end of the day. 

I really think your best bet is to close the book on 32 bit cmd.exe and start working with Power Shell at a minimum. 

Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2618
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #15 on: August 17, 2021, 01:24:48 pm »

Quote
Therefore the //d is not executed as a command switch.
The /d option is given for the 'cd' command, not for cmd. Everything after /k or /c is a separate command with its own options. We want to run 'cmd /k command', and the command we want is 'cd /d "drive:\path"'

So the command above does work (for local and mounted drives). I tested by mounting one of my NAS folders and then running "cmd /k cd /d k:\video".

I agree that pushd/popd is messy.

Edit: also note that 'c:\windows\system32\cmd.exe' is a 64-bit process, and 'c:\windows\syswow64\cmd.exe' is a 32-bit process (Microsoft Logic™). If you type just 'cmd' you get the 64-bit one. Powershell also has both 32 and 64-bit versions in those same folders.

Logged

Outlaw Audio

  • Junior Woodchuck
  • **
  • Posts: 69
  • Dogs......because people suck
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #16 on: August 17, 2021, 01:56:40 pm »

Thanks for the further clarification, re 32 bit/64 bit, this is why I hate Windows straddling 32 and 64 bit like they do. 

I was about to ask you how you got the command to work on your NAS drive but then noticed you said "mounted" drive.  I don't mount any of my NAS locations for my windows boxes
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2618
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #17 on: August 17, 2021, 01:57:52 pm »

Neither do I, was just for testing. That's why I said above that this doesn't work with network paths.
Logged

elprice7345

  • Galactic Citizen
  • ****
  • Posts: 254
Re: Can I use "Send To (external) to open a DOS Window?
« Reply #18 on: August 17, 2021, 03:13:52 pm »

Nevermind, I'm an idiot. I forgot fwd-slashes need to be escaped here as well! Try:

program path: cmd.exe
parameters: //k cd //d "[Filename (path)]"
Thanks @zybex! That works perfectly for my situation! All my media is currently stored on local drives, so I can use either PowerShell or MS DOS.

Thanks @outlaw_audio for the PowerShell option!
Logged
Pages: [1]   Go Up