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

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!

Related

Why does this command work in Terminal but not in 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.

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.

Windows Run dialog and cmd

I have a simple problem in which I can launch a program with the Run dialog n windows, but not from the CMD (or PowerShell).
The command is steam://run/<app-id>
I would like to know how to run the same command from the console. I tried steam steam:// Steam.exe but none worked (the last one only opened steam)
In the command window, use the start command
start steam://run/<app-id>
Not really the right forum for this Q, but a quick google leads to Valve's pages that show the command-line options for steam.exe. I'd recommend a google yourself, but for completeness it looks like steam.exe accepts a -applaunch parameter.

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}

Open a file from Cygwin

Is there an equivalent to OSX open command in cygwin. open opens a file with the default application for that type.
I want to do something like
$ magic-command file.xls
#excel opens as if file.xls would have been double-clicked
$ magic-command file.txt
#notepad opens as if file.txt would have been double-clicked
You get the idea?
Basically something like a "cygwin-double-click" command.
You can also use the cygwin utility:
cygstart <your file>
To make things OSX-like add the following to your bashrc
alias open='cygstart'
Don't forget to check out the man page for cygstart.
You can use the start command from the CMD like this:
cmd /c start <your file>
explorer <your file>
works too. What is nice is
explorer .
opens a windows explorer window in the current directory. But then
cygstart .
does the same thing and does more, but I find 'explorer' slightly easier to remember.
I am using Cygwin in Win7. I can run file on windows through ccygwin command line.
cygstart <your file>
when you run this command your file will open in windows.
Under the Windows command-line interpreter (cmd.exe) there is support for the start command. I know of somebody who implemented start in cygwin. You can find the page about it here.
You could also simply call cmd.exe (usually located in /cygdrive/c/windows/system32/cmd.exe) with the following arguments cmd /c "start yourfile.file"
If, like me, you are using putty to ssh locally on your windows machine to Cygwin as cmd.exe is a terrible console, you may want to change your sshd service to allow it to access the local desktop (this will only work on certain windows flavors) under the sshd windows service Logon properties.
Yes, there is an equivalent to Windows, try with xdg-open <your file>

Resources