How to specify to start an application in the specified process in command line.I mean let us take a look at the below command
start "cool.mp3"
it opens the file cool.mp3 in the windows media player but i want it to be opened in the VLC player.How do i mention it?How do i tell to open the file in the VLC player or some other real player.Can we mention the application to run in the specified process ? If so how?
start uses the file associations set by the user. If you want a specific program, then just do so:
"%ProgramFiles%\VideoLAN\VLC\vlc.exe" cool.mp3
Also note that the example you gave can never work with start anyway.
Related
How do I delete/remove the "Error.error" file when the system says it is not there but it is?
The Error.error file was created somehow and I do not know why or how. However, the issue is the system has created this 0 byte file called "Error.error" and it cannot be deleted, even if I try a "permanent" delete command. It also will not allow me to delete any of the folder directory hierarchy in which is resides. When I do try create it, rename it, or create a physical file with the same name and extension, or try to delete this file directly or indirectly I receive the following error message:
"Could not find this item: This is no longer located in C:\maps\test. Verify the items location and try again." Then it list "Error.error" and its information. However, it is there visually.
Any thoughts or suggestions on how to remove or correct?
Thanks!
I had a very similar issue not too long ago where I had a file that was created by another program and whenever I tried to access or delete it, windows would give an error message like "...This is no longer located in...".
If you're having the same problem I was, here's how I got rid of the file. Start a command prompt. In the command prompt, enter a command like del "\\?\<full path to file>". So if your file name is "Error.error" and it is located in the folder "C:\maps\test", the command you would enter is
del "\\?\C:\maps\test\Error.error"
You can delete a folder that windows won't let you access in a similar way by changing the command from "del" to "rd /S".
If you don't know how to start a command prompt, simply click the start button and type "command". The start menu should offer an option named something like "Command Prompt - Desktop app". That's what you need to start.
I found a good explanation of what the "\\?\" means here.
I am running Vanilla AutoCAD 2017
The accoreconsole.exe will start but and show the example Screen and will appears to run commands, although i am unaware of a way to open a file directly from core console so i cant really do anything with it.
Methods attempted
1. Script Pro 2.0:
From https://knowledge.autodesk.com/support/autocad/downloads/caas/downloads/content/autodesk-customization-conversion-tools.html
Script pro executes scripts successfully when using AutoCAd But then Fails when i switch to Core Console
It generates a log file that reads: Error while reading log file for C:\Users\Documents\TEST\ARCH01_FIRST FLOOR PLAN - AREA C.dwg
2.Auto Lisp
From AutoCAD using an Auto Lisp command i found on House of BIM. The command works and i tested several scripts which i first tested using the Run Script Button in AutoCad and they worked, but not when i used core console.
This generated a Temp file called accc34642 which reads m_kernelList still has 1 entry
/i core console flashes and then disappears
/I core console opens a new file from the Qnew Template file path
This seems to happen no matter whats after that in the lisp statement.
Then OPEN command in core console doesn't return a prompt or an error, it just returns twice and does nothing.
Typing in a file path generates an error
3.Widows batch files
I have only used one of these in the past successfully but i checked the ones i found a couple different websites and still no luck on getting the scripts to execute.
I also tried all this from different File Paths
The main idea of AutoCAD Console is to process 1 file and exit. That's also important to avoid memory fragmentation and errors when you process multiple files in a single instance of accoreconsole.exe
So, as already mentioned, consider a workflow where each instance process a single file and then exit. You may even consider multiple instances of accoreconsole to process multiple files at once.
Wed0,
to get started with working with accoreconsole, here are a couple links that will help you:
1) http://adndevblog.typepad.com/autocad/2012/04/getting-started-with-accoreconsole.html
2) http://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-console.html
for the second article, Kean goes into quite a bit of detail, but I don't especially like his approach with using .bat files. It is much nicer to use a programming language like C#.
As for opening files, it actually is possible!
I recently discovered a VERY fast method of processing dwg files using accorconsole (or AutoCAD if that is what you prefer). For example, running a search and replace operation of dbtext and mtext on a batch of dwg files runs at around 15 drawings/second on a single process. Setting up 5 or 6 in parallel will process close to 5000 drawings/minute! I thought I would share this with the community as this discovery has been a game-changer for my company when it comes to processing large batches of dwg files.
For this you have to use the .NET API(or C++, etc). I did all the code for processing in C#, and the only 2 lines in the lisp script file is to NETLOAD my dll and call the command that does the processing.
Turns out, you can work on multiple dwg files in the same instance of accoreconsole. The idea here is to just load the dwg database without actually opening the drawing (takes ~70ms), manipulate the database, then save it. For the i/ switch, you can use any dummy drawing file as it will have no effect on your batch. Then in C# in your command method, you would do something like this:
string[] dwgFiles = Directory.GetFiles("C:\\MyDWGFiles");
foreach(string drawingFilePath in dwgFiles)
{
using(Database database = new Database(false, true))
{
database.ReadDwgFile(drawingFilePath, FileShare.ReadWrite,
true String.Empty);
using(Transaction transaction =
database.TransactionManager.StartTransaction())
{
//DO STUFF HERE
transaction.Commit();
database.SaveAs(drawingFilePath, DwgVersion.Current);
}
}
}
Let me know if you have any questions or need more detail,
I don't believe it is possible to open files from within core console. I am relatively certain core console has to be initialized with the path as an argument of the drawing you wish it to open. Once it is open you can then do work with that file. So, you would essentially have to open a single instance of core console for each file you want to do work on.
Hope that helps.
The best way as drive AutoCAD commands as dwg files is use the concept mencioned by "Autodesk Knowledge Network": Out-of-Process .NET
a. https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-NET/files/GUID-C8C65D7A-EC3A-42D8-BF02-4B13C2EA1A4B-htm.html),
and this alternative is supported by Autodesk; the accoreconsole is not.
With this features, you may execute AutoCAD software, open Projects, batch iterates on files and manipulate data. Recently, I developed one plugin that has two requirements:
b. be executed without user-intervention and,
c. interates on all Dwg files to execute a process per-file;
Like link above, I instantiated AutoCAD and send commands like a lisp sintaxe to call the customized command (as "("CUSTOM_CMD", "PARAMS1", "PARAMS2" ...)" );
My custom command was like this:
[CommandMethod("CUSTOM_CMD")]
public static void CustomCmd
{
//stuff iterate on DWGs
}
3.Comments: It's importante to use Thread Safe Collection (for example ConcurrentBag) to memory Dwg Collection to ensure non interference between Next Moving contiguous Dwgs iteraction's running.
I need to open 2 Edge windows from a batch file (not two tabs, 2 windows). I know I can launch edge using the following command:
start microsoft-edge:
But if I try it twice the second command does nothing. If I try it with URLs I get 2 tabs in the same window. e.g.
start microsoft-edge:http://google.com
start microsoft-edge:http://bing.com
Any ideas how to get 2 separate windows?
Use --new-window option:
start msedge http://google.com
start msedge --new-window http://bing.com
As you are aware, you can trigger Microsoft Edge indirectly from the command line (or a batch file) by using the microsoft-edge: protocol handler. Unfortunately, this approach doesn't enable you to open up an arbitrary number of windows.
The Microsoft Edge team built a small utility to assist, and presently hosts it on GitHub.
> MicrosoftEdgeLauncher.exe http://bing.com
> MicrosoftEdgeLauncher.exe http://stackoverflow.com
I just tested this, and it opened two individual windows for me. There does appear to be an issue where the second window doesn't navigate to the URL; remaining open with the New Tab Page.
You can open as many as you like, just create batch files that call other batch files.
Very easy to do.
Ex: batch1.cmd:
#echo off
start microsoft-edge:http://google.com
start "path\batch2.cmd"
exit
Make sure to add "start microsoft-edge:http://bing.com" on your "batch2.cmd" file
Manny
You can use the executable msedge_proxy.exe which is installed alongside msedge.exe. For example in "C:\Program Files (x86)\Microsoft\Edge\Application".
Sample usage:
> msedge_proxy.exe --app=http://bing.com
If you execute that command multiple times, it pops a new window each time.
I have an executable that accepts typed user input on three seperate lines on the GUI. The executable also has a button called "create file" that will perform a file creation based on the typed data. My question is how can I automate passing the three typed values into the executable and then execute the "create file" button all from a batch file? I do not have access to the source code so I cannot make modifications there to achieve this.
(Im not able to write comments yet, so I have to use an "answer")
I agree Cebence, as far as I know you need some kind of macro player. Best free I know of is autohotkey (just google for it). It needs a bit reading in at first but is pretty easy to use and very versatile.
Well, this is not really a batch file solution - I don't think one exists. But you could use a tool like Spy++ to find the IDs of the relevant dialog controls and then write a program to:
Launch the executable
Retrieve the main window handle
Send the appropriate window messages
There is probably software out there that can do this. Maybe there's something that you can batch which will just take the process name or ID and pass a single message to it.
If the GUI application doesn't support command-line arguments BAT file will not be of much help here.
What you actually need is some kind of "GUI macro player" application that will execute a script, i.e. macro like this one:
Switch focus to running application named "XYZ"
Find the input box named "text1" and type in "${param1}"
Find the input box named "text2" and type in "${param2}"
Find the input box named "text3" and type in "${param3}"
Find the button named "button" and click it.
I don't know if there are (free) applications that can do this now, but there was a free application called "Act!" or something like it (its icon was a yellow Mickey Mouse glove with a finger pushing a button). It was actually a ZIP file containing a running Windows executable and Delphi application source code, but I can't find it now on PC Magazine's website.
Hope this helps.
I can find plenty of answers on the internet about how to open a specific file, e.g. http://answers.yahoo.com/question/index?qid=20080102230630AAfu5dF
However, I need to provide a way of opening a non-specific file in a program called by a batch file.
To explain, here is an example. The user has a folder with 100 files in with the .xyz extension. He wants to be able to double click on ANY file and open it in his "XYZ Viewer," but to run his XYZ Viewer he needs to run a batch file that alters his registry and then runs the actual XYZ Viewer .exe.
If you select the batch file to be the default program via the "Always use the selected program to open this kind of file" tickbox, it will open the program, but without using the standard Windows function of opening the file that instigating the running of the program.
Is there a way to run the program through the batch file and for it to both run the program and open whichever file it was that instigated the running of the program?
I suspect this is impossible, but any suggestions would be very gratefully received!
Cheers.
Edit:
The program does eventually support opening a file placed as an argument to it.
My code is
reg import c:\regent\31.2.03.reg
start C:\Program\Program.exe
Does the program eventually support opening a file placed as an argument to it? In the example you linked, mspaint opens the first parameter given to it.
If your batch file isn't currently doing this, you will have to edit it to contain the batch parameter(s).
See http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true for some fuller documentation on it.
Essentially you want to add %1 somewhere like:
reg import c:\regent\31.2.03.reg
start C:\Program\Program.exe %1