I am looking for a way to create a Powershell script that will allow me to open DB Browser for SQLite ("C:\Program Files\DB Browser for SQLite\DB Browser for SQLite.exe") and upon opening, load a file (C:\Users\XXXXX\AppData\Roaming\AirHauler2XP\Company\Atlas Airlines25045 PM.db) in order for me to edit. Any help would be great (if possible).
Please see the documentation: https://github.com/sqlitebrowser/sqlitebrowser/wiki/Command-Line-Interface#examples
According to that, it should be:
"C:\Program Files\DB Browser for SQLite\sqlitebrowser" "C:\Users\XXXXX\AppData\Roaming\AirHauler2XP\Company\Atlas Airlines25045 PM.db"
#ChristianBaumann is OK, and it will work from command prompt. But for powershell this will fail. You need to use & to run it:
& "C:\Program Files\DB Browser for SQLite\sqlitebrowser.exe" "C:\Users\XXXXX\AppData\Roaming\AirHauler2XP\Company\Atlas Airlines25045 PM.db"
I would add it to the path one way or another.
$env:path += ';C:\Program Files\DB Browser for SQLite'
cd AppData\Roaming\AirHauler2XP\Company
sqlitebrowser '.\Atlas Airlines25045 PM.db' # tab completion on the filename
Related
I have created two independent batch files. Both open web browsers. One opens Firefox and the other Opens Edge. Both batches are opening multiple tabs in their respective applications. How do I write a batch to pass through the Control + Tab keys in batch at the end of my file to go back to the first tab?
Can this be done with Edge and Firefox? Can they be written the same way?
I don't need the tabs to refresh upon the switch.
I've tried this for Edge,
#echo off
start microsoft-edge:"https://stackoverflow.com"
start microsoft-edge:"https://google.com"
timeout 2
$wshell=New-Object -ComObject wscript.shell;
$wshell.AppActivate('microsoft-edge'); # Activate on EDGE browser
$wshell.SendKeys('^+{TAB}'); # CONTROL+SHIFT+TAB
..to no prevail. Yes, the batch starts and opens Edge and applies the two addresses to two tabs but I can not figure out how to SendKeys to the application.
Any Tips or Pointers will be greatly appreciated. Thanks in advance.
I've tried many ways to send keys combination but the combination of ^+{TAB} seems always not work. I find a software called AutoHotkey which can achieve your goal.
You can first download the software and create a autohotkey script file named test.ahk, with following content:
send ^{TAB}
exit
Then run the test.ahk in bat file:
#echo off
start microsoft-edge:"https://stackoverflow.com"
start microsoft-edge:"https://google.com"
timeout 2
$wshell=New-Object -ComObject wscript.shell;
$wshell.AppActivate('microsoft-edge');
"C:\Program Files\AutoHotkey\AutoHotkey.exe" "C:\Users\username\Desktop\test.ahk"
Please notice to replace the path with your own path. I've tested it and this could be a workaround.
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 a demo.txt file. I need to delete content in that file using a batch file. Please tell me the command to delete content for demo.txt file.
break>demo.txt
Try this.it will set an empty file on the place of demo.txt. As break is internal command that does nothing it should be pretty fast.Also the break command can produce output only with /? argument so this makes this method pretty robust.
Command Prompt:
break>c:\'file directory'\demo.txt
PowerShell:
Clear-Content c:\'file directory'\demo.txt
type nul > demo.txt
works and also works in JPSoft's TakeCommand TCC.EXE command shell (where "break" will output "BREAK is ON" rather than nothing as it does in Microsoft CMD.EXE)
The general idea is to find a command that outputs Nothing and redirect that to the file using >
This seems most intuitive to me:
copy /y nul demo.txt
NOTE: Unfortunately, like the other methods provided here, this fails if demo.txt is currently in use by another process. In such a case it is sometimes possible to open the file in a text editor and delete all the contents, even though the file is in use. I don't know of a way to do this from the command line.
If the file is used by another application command prompt redirection may fail (as it requires more file access then necessary). In that case you can use powershell:
PS> Set-Content file.txt $null
Note: do not expect that it will allow access to exclusively opened files.
I am trying to install through batch file..
ECHO OFF
ECHO Installing MySoftware . . .
"%~dp0\MySoftware.exe" /S /v/qn"UPGRADEADD=link goes here"
pause
but it fails to install.
Not much info to go on. What you have will not work if executed from a UNC drive and may not work if you 'Run as administrator' because the current directory gets changed. Try this. Of course that may not fix it and further details would be nice.
#ECHO OFF
PUSHD "%~dp0"
ECHO Installing MySoftware . . .
"MySoftware.exe" /S /v/qn"UPGRADEADD=link goes here"
Adding to my answer based on comments provided.
Presumably your bat file is in the same folder as MySoftware.exe. If it takes that long, it sounds like the install is working. Try doing
"MySoftware.exe" /?
That may give you a help screen to tell you more about the arguments beng passed. Also, try what you are now doing without the /S (which probably specifies a "silent" install... which is why you don't see anything.
PART 1 - If you want to create a "Setup" File in batch.
Maybe it works, but this is will be very hard to you for done this program.
Let's call the EXE File "Game1:
I will recommend you to take all the Game1 file's code (Maybe you can use the program Notepad++ for do this) after you taked Game1's code do this like i writing here
Let's say that the code of Game1 is:
ABC
Copy the code, then go to the batch file.
The "Setup" file of Game1 HAVE to come with a empty EXE file.
You can make a empty EXE file with notepad - just save the file as:
Name.exe
Then you doing at the batch file script this thing:
set %something%=ABC
After you done this you adding this to the batch script:
Echo %something% >> Name.exe
Don't forget to name the EXE file at the name of the program / game.
And now, if this message didn't help to you, maybe you need to make a EXE from batch file.
PART 2 - If you want to make an EXE file of batch file.
Open the start menu of Windows and search this:
IExpress
Don't let the computer search for you the full name, its working only if you wtiting the full name.
After you search IExpress, click on "Activate Command".
Click on Next, Don't change the first options.
Click on "Extract files only" and click on Next.
Name the EXE program and click Next.
Stay on "No prompt." and continue.
Now you can display a program License. if you want do a txt file and choose the display option.
Add batch files and click Next.
click on the option you want and click Next.
If you want a finish message, click on display message and write the message.
Here browse where the EXE will be and choose your options, click Next.
click Next.
Wow that's was super-long! Hope I helped you!
I have a user, which couldn’t get along with AutoCAD so he switched back to InterCAD. He’s not too computer literate so now when he tries’s to open a DWG file (AutoCAD native file extension) by double clicking it he’s register settings look for the AutoCAD program to open it.
I know that we can tweak the register settings for a .dwg file to open the file automatically with InterCAD rather then AutoCAD.
I’m not too un-familiar with tweaking the registry keys and when I do I like to automate this using batch script.
What is the best procedure to do this, I'm namely worried I will miss a key or is the following the only key I need to tweak
HKEY_CLASSES_ROOT\.dwg\OpenWithprogids
The extension to execute Intercad in Intercad.exe
How do I successfully achieve my desired result?
The key you need to edit will be this one:
HKEY_CLASSES_ROOT\dwgfile\shell\open\command
That controls the program the file opens with.
To do this in a batch file use this:
reg add HKCR\dwgfile\shell\open\command /v "" /d "programpath.exe" /f
Hope this helps.