Why does this command work in Terminal but not in CMD? - cmd

Dopusrt.exe /acmd Go "c:/"
The above command works, last active Window goes to c:/ but the below command does not work.
Dopusrt.exe /info documents\filelist1.txt,listsel,0
The weird thing is it works just fine in Windows Terminal. Does CMD reserve commas for something? I really need to use CMD in this case, Since Auotohotkey seems to only speak to CMD.
Thank you.

CMD and Windows Terminal are not the same type of application. CMD is a shell, and WT is a terminal. See this post for more details.
You can run any shell you'd like in WT - CMD, PowerShell, whatever.
CMD.exe does not by itself reserve commas (to the best of my knowledge). And running cmd.exe in WT vs running it in conhost (the default console on Windows) shouldn't make a difference either.

Related

Use Windows Terminal in place of cmd when a command line exe is executed

I have a couple command line apps (launch4j + java.exe) I use.
I'd like to run them on Windows Terminal instead of cmd.exe. But, even after installing Windows Terminal, when I execute the launch4j exe, it still runs on cmd.exe.
If I run wt myapp.exe -oneinput it works, but I'd like to run myapp.exe directly.
Is there any setting I must do so that Windows Terminal is used in place of cmd.exe?
The Windows Terminal team are working to enable Windows Terminal to become the default command-line user experience on Windows.
Stay tuned to the Windows CommandLine Blog for news and updates on up-coming features.

How to run VSCode from the command prompt

I for security reasons cannot run VSCode plainly. I have opened it in the past, but now due to specific reasons, I may only run VSCode from the command prompt. I've tried
start "path/to/file" code and start code "path/to/file"
but none work I'm on Microsoft Windows [Version 10.0.17134.407]
how may I run this by going to Windows+R then 'cmd' then start/ run?
Also it would be great if I could use this for a separate user.
I'm looking for something like:
Runas /user:user\admin /savecred "C:\Program Files (x86)\vs-code.exe"
The use of start is useless if VSCode is in the environment variables.
You can use code C:\Users\%username%\Desktop\File.c for exemple.If it doesn't work, I advise you to use a vbs script instead
You also don't need to run VSCode as an administrator unless you need to edit a file in a protected folder.
Maybe not the exact answer to the question, but...
To start Visual-Studio-Code from CMD into the current folder write:
code %cd%
The environment variable cd tell VS-Code to open it with the current folder
just open a cmd terminal and type code followed by
just open a cmd terminal and type code followed by return keyborad key.
Well shoot, as it turns out that after doing some experimentation I found out that there's a way. Do this:
Simply stick this:
runas /user:Techtiger255\admin /savecred "C:\Users\Admin\AppData\Local\Programs\Microsoft VS Code\Code.exe"
inside of a shortcut (.lnk file)
Open your command line of choice (Powershell or Cmd) and enter the exact file path of your shortcut ex:
"C:\Users\Standard\Desktop/VSCODE.lnk" and hit go, stupidly simple really, just had to find the code.exe file path.

cmder - Command to open split cmder

I've searched everywhere and I can't seem to find (what should be simple) a command that opens 2 cmder windows side by side:
And run my own commands in each one.
How can I do that using commands only?
I eventually found the answer in the ConEmu github pages (sort of) by using the -new_console:s flag.
start cmd /k "foocommand"
start cmd -new_console:s /k "barcommand"
Run the above commands from cmder and it works. The only problem is that it doesn't automatically open cmder, and you have to run it from cmder but at least it works. Starting a cmd from cmder opens a cmder automatically.
... ok since there is no "real" answer in here, I thought I'll post my solution:
if you execute the line below in a windows cmd (exchanging Cmder.exewith the path to the Cmder.exe) it will do just what you've asked for without having to mess around in the cmder gui
Cmder.exe /x "-run cmd" & Cmder.exe /x "-run -new_console:s cmd"
One can right click on the top of Cmder and do as shown below snapshot

How to launch a program from perl?

How do i launch firefox from perl? i just need to launch the browser so WWW::Mechanize::Firefox can manipulate it. Searching around stackoverflow ive seen a few solutionsl like system('start cmd.exe /k $cmd) where $cmd is arguments to throw as input once cmd is started.
However, these have not helped me to solve my problem at all.
solutions ive tried
system("start cmd.exe /k start firefox");
system("firefox");
system("cmd","start","firefox");
system("cmd start firefox");
Basically a lot of the alternatives ive found, but i could not launch Firefox browser at all.
You're on the right track. Your second line is almost correct. If firefox is not in your PATH environment variable, you need to supply the complete path.
Click on the Firefox icon on your desktop, open the properties and check where the firefox executable is located. Then use that with your system call.
For me, it looks like this (the ' are for Perl's string, the " are for the Windows shell, because the path has spaces in it):
system('"C:\Programme\Mozilla Firefox\firefox.exe"');
You can test it by opening a new command line (win + r, cmd), cding to the directory where your Perl program is run from, and just entering the command:
C:\Dokumente und Einstellungen\simbabque>"C:\Programme\Mozilla Firefox\firefox.exe"
It will not print anything, but just open a new Firefox window after a couple of seconds. So you'd probably need to hold your program execution in Perl while the browser is starting up.
WWW::Mechanize::Firefox will launch firefox for you but you can use
system 1, qq{$ENV{PROGRAMFILES}\\Mozilla Firefox\\firefox.exe}

Why is Windows 'Run:' different from CMD line?

When I type 'http://www.google.com at the Windows Run: prompt it launches my default browser.
But when I do it at the CMD or Commnad prompt it does not. I assume that there is some form of RunDLL command being issued but I can't find out what.
Does anyone have any insight?
I think it's the equivalent of using START.
If you try
START http://www.google.com
from the command line (or a batch file), it should work fine.
What Jon said appears to be correct. I tested it with mailto:someone#somewhere.com. Interestingly if you wish to make run work like the default behaviour of cmd, you can do the following:
Start -> Run -> cmd /c http://www.google.com. Not sure why anyone would ever need to do that though!

Resources