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

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.

Related

Why does nothing changed to open a program in windows while using the assoc command to alter the specific extension to another different?

I use the windows 10 pro version and open the command prompt as the administrator to run the windows commands in my laptop. Using the assoc command to change the file extension file to another different (e.g. assoc .jpg=txtfile), I find nothing changed after running it and still that jpeg file opens with the regular program instead of notepad. In addition I can see the only change in by typing just the assoc and running it when a list of extensions belonging to different programs appears. Fo instance I have changed the .jpg file to txt file that it shows only as '.jpg=txtfile" in the list but tyat is still opened in jpeg program not notpad? Is anyone here to help me with clearly. Thanks
You need to use ftype as well. I have a link saved to MS docs that says it is up-to-date till Win8: https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc771394(v=ws.11).
Maybe nothing has changed in Win10, but you get the idea from the above and can Google it for Win10.

How to open a file in a specified program using window comand prompt

How can I open a file from the command prompt in a specified program rather than the default program for opening the file.
like in MAC terminal
open main.js -a "Sublime Text"
currently I only do
start filename.extension
which opens the file in the default program.
please what command can I use to achieve this?
With Windows, you type application first.
So with Notepad, which is on the Windows path, you can type
notepad filename.extension
By 'Windows Path' I mean a list of directories that Windows looks in for your application. If your app is in one of those folders, then you only have to type the application name. If your app isn't, then you need the full path to the application.
Most of the Windows native apps (like Notepad, MSPaint, etc) are automatically on the path. However apps that are installed afterwards sometimes don't update the path and you need the full path. You can usually get this by right-clicking on the application and getting properties. Often you'll need quote marks - specifically if there are spaces in the path, which there usually are because "Program Files", so:
"C:\Program Files (x86)\Notepad++\notepad++.exe" filename.extension
Note the quote marks go around the path to the application file itself - not all the way to the end of the line. An easy way to check that you've got the full path to the file is with the dir command:
dir "C:\Program Files (x86)\Notepad++\notepad++.exe"
Some applications expect instructions about what to do with the file, and you may need to figure out what else to put on the command line. Usually google will tell you this.
For example, to execute an SQL script, with one tool I use, just putting the filename on the command line won't work, you do something like:
"C:\Program Files\PostgreSQL\9.4\bin\psql.exe" -U user -d dbName -f filename.extension

Command-line equivalent of "start in" field on windows shortcuts

I'm in Windows 7. I have an executable. I put it somewhere. I put this location in my path. Now I can start it from anywhere using cmd. I have a different location where I work containing files the .exe will process. I shift right-click to open cmd in the work location. I can run the exe, but the exe starts in its own location and can't find the files. If I were to create a windows shortcut to it, I would get a "start in" field, which would work. But I do this a lot from many different locations and I don't want to create a shortcut in each location. How do I do this on the command line without creating a shortcut? It would be great if I could just run something like
progam /startin .
What is the actual syntax?
#echo off
setlocal
pushd "c:\where\you\want\to\start"
programname
popd
This is the basic structure.

"edit" not a valid command in cmd.exe?

I'm trying to create a .cfg file for bcc32 compiler and I'm following the instructions. I have installed correctly and placed an environment path as instructed but when I type "edit bcc32.cfg" into the command prompt it says that edit isn't a valid command? What am I supposed to do?
You could also create a .bat file, edit.bat, to replace the 16-bit edit program (removed because x64 windows flavors won't run it) which would launch your favorite editor.
#echo off
notepad %1
#echo on
This is what I wound up doing as a simple patch so I could carry on the way I always had for the most part. Just type:
edit myfile.ext
in the command prompt to use it.
Note: notepad is not my favorite editor - this is just an example that will work with stock windows.
Note 2: #echo off and #echo on are shown for clarity. You may also shorten this by omitting the echo statements and simply placing the # before the command to be silenced.
#notepad %1
I just use notepad (since they took out the edit command) from the command window like so:
C:\Borland\BCC55\bin> notepad bcc32.cfg
The file will open in notepad for editing. When you've finished editing the file, save it and you're done.
I have found this works for seeing in-window text of a complete file, on a 64bit machine. Once your path is set in cmd prompt, type the word type... followed by "filename" do you see how I used the quotes around the filename only!
type "filename"
You type it just like this (changing filename for your files name) and you will be able to see the entire file text in the cmd window. Not sure how to edit from here on but maybe someone can figure it out from here and tell me.
Assuming you're using Windows 7 (where edit.exe and edlin.exe have been removed):
Use powershell.exe instead of cmd - thereby edit will be available via command line.
Take a look at: http://en.wikipedia.org/wiki/Windows_PowerShell
simple answer....
if your using an old version of windows (xp e.t.c...) you would be able to use edit
but since your using new version of windows, Microsoft has updated and removed the commands that they think are not relevant e.g.. (msg, edit) depending if its a bit32 bit64 or bit82...

How to restore bat file execution from explorer on XP

some bat files need to be launched at the start of the session, but they don't.
Actually, when trying to launch one from the explorer, it opens the Open with window instead of just runnig.
However, the bat files still run correctly from the command prompt.
I bet it has been caused by a virus, but the antivirus did not detect anything unfortunately.
Any idea?
Use the Open With command, select cmd.exe, then before you hit OK, check the box that says "always use this program to open this type of file" or something similar.
If cmd.exe is not in the choices, browse to c:\windows\system32, and cmd.exe should be in there.
You can re associate the extension by downloading the reg file for batch from the link below which should solve your problem.
http://www.dougknox.com/xp/file_assoc.htm

Resources