I have a bat file and I can run this file as administrator by right click on it. Now I create a link which calls the bat file on html page. I want to hit the link and run the file as administrator.
The code which calls my file normal way.
Restart DirectDataLink
Adjust the script (Link) below the line ::START that needs to run elevated in below posted batch script. For your example: call service-restart.bat and save it as RunElevated.bat
Change your link to Restart DirectDataLink.
The RunElavated will call your batch script and will try to "selfelevate".
Related
I want to download a large file from gdrive in remote server. I can download the file in my Chrome via clicking download and confirm. My question is how can simulate the click download button in a terminal or a simple programming script so that I can download the file on my remote server.
Take an example of this file
I can check the Chrome network
(it does not work for gdrive, but works for some website) Though I do not understand why it works, I can use the feature copy as curl and get runnable terminal cmd to download some file.
Note
I find there is a good python package gdown and easy to use. However, for some large file, it can not work. For exmaple, this 500mb file.
For the large file, gdrive ask a another confirmation
It would be great if I understand how "download button" works and simulating click action in remote server.
I am downloading a file from AWS S3 in a github action. In the next step (same job) I am trying to edit the file. Sometimes the file is still there, and sometimes it isn't.
Each step runs a bash script, and I check at the end of the first step that the file exists. The file is being downloaded to the $HOME directory, so the path to the file is /home/runner/my-file.json
Where should I download the file to, to guarantee that it is still there on the next step?
Just to close this off, files downloaded to $HOME are persisted between actions in the same job. I finally realised that the next step is trying to edit the file twice concurrently (I'm using some lerna scripts) and that is why it was sometimes reported as empty.
Unfortunately, you can't keep this file after finishing the action running, so to solve this, You should push this file to the repo where this action is currently running on, this could be done through git commands.
Thanks
I have created setup using installshield and everything is work file. Now I have one batch file and want to run with setup. I know we can create custom action and I have already created custom action for run powershell script and it is working fine.
Can anyone help/guide me for using which custom action I can execute the batch file?
Also I want to run MySQL script from installshield setup.
What I have tried:
I have tried to create different custom action but I don't know exactly which custom action is used for execute the batch file.
ASSUMING AN MSI INSTALLATION:
In your MSI Installation Designer pane, click on "Custom Actions and Sequences"; in the top part of the middle pane right click on "Custom Actions" and choose "New EXE -> Stored in Binary Table". Give it a name (and description, if you like). When it saves, right-click it and start the Custom Action Wizard.
The Action Type should be "Launch an executable" and the Location should be "Stored in the Directory Table".
For Action Parameters "Source", choose the directory you want to start in. For target enter a command to invoke your script, like cmd /c .\RunMyScript.bat arg1 arg2 ... (assuming the script is in the directory you started in.) If the script is in a different folder you can put one of your directory variables in brackets: cmd /c [INSTALLDIR]bin\script.bat. Typically the directory variable will already include a trailing backslash; using these variables with the bracket syntax helps make sure the action works even if the user chooses a different installation folder.
If the script is in a folder that is not a required part of the installation, you may need to make your command be something like cmd /c if exist .\script.bat .\script.bat - so that the custom action does not fail if the feature containing your script is not selected for install (or is removed when an installation is modified.)
I have typically wanted execution to be synchronous (install waits until script finishes before moving on); if your script does not return a reliable exit code, or if you don't want the installation to abort if the script fails, choose the one with "(Ignores error code)".
The custom action should typically be in the InstallExec sequence, after files are installed (but a script you run during an uninstall or repair could run earlier or in a different sequence.)
I'm looking to find a way on how to start a .bat file from a webpage. This bat file just start a server.
My intention is to create a basic html page showing "Start server" and "Close Server".
Is there a way to do so? I was thinking to do it by an FTP server using HTML but it didn't helped me.
Thanks
With a static page would be difficult but for example using php :
<?php
exec('c:\myfile.bat');
?>
If you donĀ“t want execute the .bat locally you will execute a shell script (.sh) that executes remotely the batch file.
https://superuser.com/questions/292818/run-a-shell-script-with-an-html-button
You need to call cgi script for this action with proper access to start your services. Html doesn't have any access in server side. It can only trigger the request.
Put 2 files in your web folder:
Static html showing your bottoms
A PHP file to call the batch.
Just remember to install PHP on your IIS
I'm working on a simple TCL script that makes a few Tk dialogs appear and then compresses a file given by argv. It works just fine from the terminal by running "./script file", but since it's a graphical wrapper for a command-line utility, I want it to run from the right-click menu in a file manager.
I copied it to /usr/bin and used Caja's "Open With Other Application..." option on a random file (no spaces in the path), and entered the name of my script as the application to use. When I tried to open the file this way, there were no dialogs and no archive.
However when I tried to run the script from the terminal again, without the "./", it still worked.
What needs to be done to run a TCL script on a file from the right-click menu and still be platform independant?
Maybe you could start with determining wether Tcl or the file manager is the problem. Write a shell script...
#!/bin/sh
exec rm -- "$#"
...make it executable with chmod +x and try to use it as an "other application" on a file you don't care about. If the file isn't erased, Tcl isn't to blaim.
I have fixed the script in question. I don't know why the dialogs broke or why they are working now, but the archive was apparently failing to appear because the script's working directory was automatically set to my home folder by the file manager.
The code below is what I used to direct my script to the right folder. It changes the working directory to the one containing the file that the script is being run on.
cd [file dirname $argv]
Once I set that, most of my issues seemed to be resolved, and I can now continue dveloping my script.