Drag and Drop of .Bat file to terminal #4201

Closed
opened 2026-01-30 23:40:51 +00:00 by claunia · 5 comments
Owner

Originally created by @NikolaGrujic91 on GitHub (Oct 1, 2019).

Drag and drop .bat file to Windows PowerShell/CMD and start execution of script. This will make running of .bat scripts much more convenient.

DropScript

Originally created by @NikolaGrujic91 on GitHub (Oct 1, 2019). Drag and drop .bat file to Windows PowerShell/CMD and start execution of script. This will make running of .bat scripts much more convenient. ![DropScript](https://user-images.githubusercontent.com/17230877/65967191-8375b200-e461-11e9-8f21-68acaef84b98.gif)
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-30 23:40:51 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Oct 1, 2019):

This almost certainly won't be possible, since the Terminal doesn't really know anything about what application is running in it. If the application is cmd.exe, sure this is easy. Even powershell isn't that hard. But what about WSL? Or the Azure Cloud Shell Connector / ssh, which could be connected to anything, what do we do then?

Plus, with the auto-executing of these commands, that seems like it might be a bit of a security risk to me. malicious-code.exe could always just fake a drag-and-drop notification to Windows Terminal, and autorun its malicious batch file.

There's also #904 which will probably get you 90% of the way there.

@zadjii-msft commented on GitHub (Oct 1, 2019): This almost certainly won't be possible, since the Terminal doesn't really know anything about what application is running in it. If the application is cmd.exe, sure this is easy. Even powershell isn't that hard. But what about WSL? Or the Azure Cloud Shell Connector / ssh, which could be connected to _anything_, what do we do then? Plus, with the auto-executing of these commands, that seems like it might be a bit of a security risk to me. `malicious-code.exe` could always just fake a drag-and-drop notification to Windows Terminal, and autorun its malicious batch file. There's also #904 which will probably get you 90% of the way there.
Author
Owner

@HBelusca commented on GitHub (Oct 1, 2019):

Definitively #904 seems to be what is actually wanted there. This is also what happens in the regular console: dragging & dropping a file in a console/terminal just simulates keypresses corresponding to the letters of the full path to the file.

@HBelusca commented on GitHub (Oct 1, 2019): Definitively #904 seems to be what is actually wanted there. This is also what happens in the regular console: dragging & dropping a file in a console/terminal just simulates keypresses corresponding to the letters of the full path to the file.
Author
Owner

@JushBJJ commented on GitHub (Oct 4, 2019):

Maybe instead of auto executing, a text editor like vim or notepad could be executed editing the file?

For instance in WSL:
-> User Drags file into terminal
-> Terminal receives file and checks what's the current selected tab type? (Example: Tab 3 [Selected] is currently running WSL).
-> Check's if any process is running that aren't background for example, matrix.sh is currently running
-> If it's a valid type and no processes are running, it will proceed to execute vim within the shell.

That's my brief idea on it. Though I can see multiple problems with it already so I'm pretty neutral.

@JushBJJ commented on GitHub (Oct 4, 2019): Maybe instead of auto executing, a text editor like vim or notepad could be executed editing the file? For instance in WSL: -> User Drags file into terminal -> Terminal receives file and checks what's the current selected **tab type**? (Example: Tab 3 [Selected] is currently running WSL). -> Check's if any process is running that aren't background for example, matrix.sh is currently running -> If it's a valid type and no processes are running, it will proceed to execute vim within the shell. That's my brief idea on it. Though I can see multiple problems with it already so I'm pretty neutral.
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 8, 2019):

This is a more dangerous way to suggest /dup #904 😄
Thanks!

@DHowett-MSFT commented on GitHub (Oct 8, 2019): This is a more dangerous way to suggest /dup #904 :smile: Thanks!
Author
Owner

@ghost commented on GitHub (Oct 8, 2019):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Oct 8, 2019): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4201