Windows Run dialog and cmd - windows

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.

Related

How do I execute OneNote UWA from Windows command-line?

I can't figure out how to start the OneNote UWA from Windows command-line. The best I could do is find where it's installed. However, I don't know how to actually start it up from the command-line; as, the executables in that directory don't start OneNote UWA.
C:\Program Files\WindowsApps\Microsoft.Office.OneNote_16001.11901.20096.0_x64__8wekyb3d8bbwe
PS: I tried to use the same command-line that's in Windows TaskManager (below). However, the app doesn't startup nor does it give an error; even with elevated privileges.
"C:\Program Files\WindowsApps\Microsoft.Office.OneNote_16001.11901.20096.0_x64__8wekyb3d8bbwe\onenoteim.exe" -ServerName:microsoft.onenoteim.AppXxqb9ypsz6cs1w07e1pmjy4ww4dy9tpqr.mca
I'd really appreciate any help suggestions to do this. If this is not possible (or nobody knows the answer, I would also be happy if someone knows how to associate a global hotkey to OneNote UWA.
I followed this tutorial and it worked great for me:
Launch Metro app from command line
my resultant command was this:
explorer.exe shell:AppsFolder\Microsoft.Office.OneNote_8wekyb3d8bbwe!microsoft.onenoteim
which launched into OneNote (metro/winrt/uwa version and not the desktop version)
There is a shortcut you can do that would have worked in my case. When you look at the target of the shortcut you create... instead use this command line tool to get the full target (since you can't copy from the target box in the shortcut properties window) and then use this instead:
explorer.exe shell:<target value>
get the command line tool here:
LNK file parser
careful though because the value wraps when you use the LNK file parser in a command window. You can output the result text from lnk_parser_cmd to a text file to ensure you get the correct value. Their example is:
lnk_parser_cmd.exe shortcut.lnk
you would simply use:
lnk_parser_cmd.exe shortcut.lnk > result.txt
and then you can easily copy and paste the non-wrapped text from result.txt.

code.exe ignoring command-line arguments

I hope this is an easy fix, but I couldn't find any documentation or other posts on the matter. I'm trying to write a script (cmd or pwsh) that will launch vscode with my preferences on a portable install.
When trying to execute vscode's code.exe with any arguments, it ignores them and just launches the program as if I had typed nothing else. I'm following this doc in my testing. Using alias switches doesn't work, either. The only argument that does seem to process is if I include a path.
code.exe --help
code.exe --version
Additionally, after launching code.exe, the console kind of hangs, then vscode status messages are sent to that console (even without use of the --wait switch). If I close the console, vscode shuts down. Is there a way to work around this?
When using Code via shell (cmd or pwsh), it does not use Code.exe, but the script/batch files located under Bin folder (code.cmd). These are the applications which really recognizes the command line switches.
This is not entirely clear in the Command Line Documentation page, but looking closer at the Note you will see that it does say the Program Files\Microsoft VS Code\bin folder.

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}

How to change cscript.exe to wscript.exe execution for all VBScript files?

After installing the new server, I am facing an issue.
I have lot of .vbs files, all need to run in wscript, reason, I use all those command like WScript.Echo "hello"
I want to be able to see the output when I double click the VBScript file.
But when I right click on the vbs file, I see console, I want to change the default to Windows host, globally!
How can I do that?
You can change the default scripting host to wscript.exe like so:
wscript.exe //H:wscript
If you wish to set cscript as the default host, that works in the same way:
wscript.exe //H:cscript
You can execute cscript.exe with the same arguments for the same result.
You can switch the default script engine with:
wscript //H:Wscript
Good luck!
I was able to solve it by using the following steps:
selecting the VBScript file that I want to open,
right click to select default program for this,
browse to C:/windows/windows32/wscript.exe, and select this.
In command prompt (as administrator):
To set windows script host as default script host enter:
wscript.exe //H:WScript
To set command line based script host as default script host enter:
cscript.exe //H:cscript
Check the Windows Explorer settings for the filetype *.vbs (something like tools->options->file types etc.) and change the "open with" setting to cscript.
Edit: I now advise caution with the recommendations I give below. After continuing to toggle and test my settings, I find I am unable to re-establish cscript as my default script host. (Note that I also retried the procedures given by other answers to this question.)
In addition, I tried using Process Monitor (a.k.a., "ProcMon") to find the reason for my difficulties, but unfortunately have not been unsuccessful.
Finally, I also considered going back to an earlier Windows 7 restore point, but this was complicated by the fact that I just yesterday changed my domain password. So, for now, I'm going to have to put my investigation to rest as other tasks are pressing.
On last thought...I have also considered the possibility that there are network policy security settings that are thwarting my efforts.
Original Answer: Enter the following line in a Windows batch file:
ftype VBSFile="%%SystemRoot%%\System32\WScript.exe" "%%1" %%*
Then, run a Command Prompt as an Administrator and run the batch file.
I believe the above will make the change for all users on the system. To make the change for only the logged in user, do the following (on Windows 7):
Control Panel => Programs => Default Programs => Associate a file type or protocol with a program
Then, in the Name column, scroll down to .vbs and click Change program... in the upper right. Then choose one of the Recommended Programs. If you do not see Microsoft ® Windows Based Script Host, browse to the following file:
C:\Windows\System32\wscript.exe
The guy above who right-clicked to choose the default program was right, however the path should be: C:\Windows\System32\wscript.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