w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Piping output from 1 command to other command in an adb shell command line
One way is to create a shell script containing the commands you want and then run the shell script. Since the Android root filesystem is not writeable at run time (usually, unless you have rooted your device and remount it), you can copy the file to the removable (or emulated) storage, for example /sdcard. Then run the script using the command adb shell sh /sdcard/your-script-name. Because each script runs in its own subshell, both of your commands will be executed in the same shell on the device (you can confirm it with ps).

Categories : Android

Batch - Execute Macros from command line
I've continued looking for it, and I found an answer to execute the macro. We should open the repertory in cmd where is the file with the macro ,put the address of the exe, write the name of it and the reference of the macros. I'll do an example: "C:Program FilesOpenOffice.org 3programsoffice.exe" FileName.ods "macro:///Standard.Module1.MacroName" if wanted directly from matlab, is just use the system('') command.

Categories : Csv

How do I execute a photoshop droplet from the command line on mac osx?
Answer: Opens photoshop and executes the droplet on the image: NOTE: '--args' omitted: open -a /full_path/watermark_foodlab_landscape_W600 /full_path/y020_Pork_Terrine_Orange_Paste_Bread.JPG Thanks Frederick that worked a treat!! Combinations tried: Opens photoshop: open /full_path/watermark_foodlab_landscape_W600 Opens photoshop and opens image in preview: open /full_path/watermark_foodlab_landscape_W600 /full_path/y020_Pork_Terrine_Orange_Paste_Bread.JPG Opens photoshop: open -a /full_path/watermark_foodlab_landscape_W600 --args /full_path/y020_Pork_Terrine_Orange_Paste_Bread.JPG Opens photoshop and opens image in preview: open ./watermark_foodlab_landscape_W600 ./y020_Pork_Terrine_Orange_Paste_Bread.JPG Opens photoshop: open ./watermark_foodlab_landscape_W600 --args

Categories : Ruby

Flyway command line filesystem migrations from actual command line input
flyway.cmd -configFile=/path/to/other/configFile.conf should do what you want. I just checked and it seems I forgot to document this on the website (It is in the usage description of the tool itself). Could you file an issue against the website, requesting this to be added?

Categories : Windows

Execute process from the windows command line in Python
By trying your code it prints out PreprocessedTufts8199PLAIN.txt.xml file name. I'm not sure if the .txt.xml extension was the desired result. If your file has only .xml extension, then you're not stripping away the original .txt header. Try to change this line: outFile = file(inFile[(str(inFile).rfind('\'))+1:] + '.xml') Into this code: fnameext = inFile[(str(inFile).rfind('\'))+1:] fname,fext = os.path.splitext(fnameext) xmlfname = fname + '.xml' xmlfpath = os.path.join(".", xmlfname) print "xmlfname:", xmlfname, " xmlfpath:", xmlfpath print "current working directory:", os.getcwd() outFile = open(xmlfpath, "r") Answer for extension stripping.

Categories : Python

how can execute nagios commands from command line in linux
You actually have the answer in your config - just execute in shell: /usr/lib/nagios/plugins/check_http -H site1.dreaddomain.com You may add -v for verbose output. Nagios is only a scheduler and executes commands at specified intervals. Then reports the state based on response.

Categories : Linux

How to open Command Prompt, change directory and execute a command using Java code (Windows)
If you just want to run an application with a specific working directory, the easiest way is to use a ProcessBuilder: ProcessBuilder pb = new ProcessBuilder(executable, arguments, if, any); pb.directory(theWorkingDirectory); pb.start();

Categories : Java

How to make this command open a new terminal & execute the command within it ( Exec=bash -c "tail -n 10 -f /var/log/httpd/error_log" )
To open a terminal Exec=nameOfYourTerminalApp (eg:gnome-terminal, lxterminal, xterm) Then you can run your commands in the opened terminal. Otherwise, you can create a script with some command and run it. In that case you have to put tail -n 10 -f /var/log/httpd/error_log in the script and make it executable. Then call it with a shortcut file.

Categories : Linux

Using C# to execute PowerShell script with command line args using V2 methods
Answering my own question here. It looks like the right approach would be for my application to function as a PowerShell Host http://msdn.microsoft.com/en-us/library/windows/desktop/ee706610(v=vs.85).aspx Use of PowerShell V2 objects is defined here: http://msdn.microsoft.com/en-us/library/windows/desktop/system.management.automation.powershell(v=vs.85).aspx

Categories : C#

How can I execute mysql query from command line on Server 2008 R2?
Usually the mysql command-line tool will get you there, where you may need to provide any credentials to get access. This comes with most installations of MySQL, but you'll need to check that it's located in your PATH or it might not be found. It may be easier to use the MySQL Workbench tool to connect and run queries instead.

Categories : Mysql

Using ProcessBuilder to execute a python script with command line options
Just give them as separate strings in the array, instead of combining the last two into "val_31 val_32": String[] command = {"script.py", "run", "-arg1", "val1", "-arg2", "val2" , "-arg3" , "val_31", "val_32", }; Otherwise it will escape the space in between val_31 and val_32 because you are telling it that they're a single parameter. Incidentally, you can also use the varargs constructor and skip having to create an array, if you want: ProcessBuilder probuilder = new ProcessBuilder( "script.py", "run", "-arg1", "val1", "-arg2", "val2" , "-arg3" , "val_31", "val_32");

Categories : Java

How to execute command line ffmpeg commands programatically in android?
Recently I came across the similar problem. My solution is to simulate a command line in Java program. Firstly, I add a function to the file "ffmpeg.c": int cmd_simulation(int argc, const char** argv) { OptionsContext o = { 0 }; // int64_t ti; reset_options(&o, 0); av_log_set_flags(AV_LOG_SKIP_REPEATED); parse_loglevel(argc, argv, options); if(argc>1 && !strcmp(argv[1], "-d")){ run_as_daemon=1; av_log_set_callback(log_callback_null); argc--; argv++; } avcodec_register_all(); avfilter_register_all(); av_register_all(); avformat_network_init(); //show_banner(argc, argv, options); term_init(); parse_cpuflags(argc, argv, options); /* parse options */ parse_options(&o, argc, argv, options, opt_output_file); if (nb_output_files <= 0 && nb

Categories : Android

Execute a command in command prompt using excel VBA
The S parameter does not do anything on its own. /S Modifies the treatment of string after /C or /K (see below) /C Carries out the command specified by string and then terminates /K Carries out the command specified by string but remains Try something like this instead Call Shell("cmd.exe /S /K" & "perl a.pl c: emp", vbNormalFocus) You may not even need to add "cmd.exe" to this command unless you want a command window to open up when this is run. Shell should execute the command on its own. Shell("perl a.pl c: emp") -Edit- To wait for the command to finish you will have to do something like @Nate Hekman shows in his answer here Dim wsh As Object Set wsh = VBA.CreateObject("WScript.Shell") Dim waitOnReturn As Boolean: waitOnReturn = True Dim windowStyle A

Categories : Shell

Execute a command when another command is executed on linux
If this is just for your own use, you can create aliases or shell functions with the same name: In bash: alias ls="ls -l" Then, whenever you do ls, it actually does ls -l (and any extra arguments are added after that). Aliases are only useful to rename a command, and/or add a few initial parameters; you can't do anything more complicated. You can make the alias run a script, of course, and do anything you like that way. Alternatively, you can create a shell function (put it in your .bashrc file, for example): Again, in bash: function sccs () { /usr/bin/sccs "$@" status=$? chmod +x "$1" return $status } I've no idea what an sccs command line looks like, so I expect you'd need to do something cleverer in there, but you get the idea, I hope.

Categories : Linux

How do you execute .exe files as administrator or give a run as admin option within a batch file in command line
Use PowerShell or VBScript from Batch to elevate privileges (via ShellExecute). Note that the runas verb is undocumented (not officially supported). PowerShell Method PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('program.exe', '', '', 'runas') VBScript Method set "VB=%Temp%Admin.vbs" > "%VB%" echo Set UAC = CreateObject^("Shell.Application"^) >> "%VB%" echo UAC.ShellExecute "program.exe", "", "", "runas" if exist "%VB%" "%VB%"

Categories : Batch File

Command works in command line but gives 'no such file or directory' in bash script
Remove the quotes around line 8. Like this: ./optAlg.exe "$inputFile" 500 2>&1 > "output/$outputFile" By placing quotes around the whole line you tell bash to execute a command which is called exactly ./optAlg.exe $inputFile 500 2>&1 > output/$outputFile and of course there is no such command. In reality you want to run ./optAlg.exe with parameters. Do not forget to place quotes around the variables because otherwise filenames that have whitespace characters are going to be passed as several arguments. Please read about arguments. And you can read about common pitfalls as well.

Categories : Bash

How do I set a command-line flag when running a Symfony2 Command test?
disabling debug in the kernel You can initialize the kernel in your test's setUp() method with debug set to false. use SymfonyBundleFrameworkBundleTestWebTestCase; class YourCommandTest extends WebTestCase { public function setUp() { static::$kernel = static::createKernel(array('debug' => false)); static::$kernel->boot(); // ... } Have a look at WebTestCase->createKernel(). using enviroments If you don't want the debug output in your logs edit/create app/config/config_test.yml and edit ... monolog: handlers: file: type: stream level: debug # log-level ... ... to another log level that suits your needs. Then execute your command using the test environment with --env=test

Categories : PHP

Always given command line before python fabric command is executed on remote
Interesting, I don't have such issue, your code works fine for me (up to adding env.key_filename and env.password) c:work>fab hello [x.x.x.x] Executing task 'hello' [x.x.x.x] run: touch hello.world Done. Disconnecting from x.x.x.x... done. I'm using Fabric 1.7.0 and Paramiko 1.11.0. Possibly it's a problem of the terminal on your server.

Categories : Python

How to get command-line equivalent of command entered in Task Scheduler
schtasks /query /? schtasks /create /? the first has an option to export to xml, the second one as an option to import from xml. If you have only one or a few tasks to schedule, I would create them "the hard way" with schtasks /create

Categories : Windows

How to issue a command from the command line of a process running on Linux
If you don't mind waiting for the calls to finish (one at a time) before returning control to your program, you can use the subprocess library. If you want to start something running and not wait for it to finish, you can use the multiprocessing library.

Categories : Python

PHP exec command works in shell and php command line but not on website
You can add the second parameter to help debug, $output will display what the cp command is doing, whether it be an error or not. I would also recommend placing quotes around the files, just in case something with a space gets in there. $src = "/mnt/..."; $dest = "/var/www/..."; exec("cp '$src' '$dest'", $output, $retrun_var); var_dump($output, $retrun_var);

Categories : PHP

php sudo shell_exec command runs from command line, but not from browser
Would it be out of the question to make a shell script that would run your command? #!/bin/sh sudo whoami in the php: $retVal = `/path/to/custom/script/myscript.sh &2>1`; if ($retVal) echo 'SWEET'; else echo 'POOP: ' . $retVal; {command} inside `` means the same as shell_exec('{command}') on a linux server. If I'm not way off base here your goal is to add users to your VPN (among other things perhaps) in which case you could pass command-line parameters for username/password/etc to your custom shell script. It's not exactly a pure shell_exec() answer to your question, but maybe you can run myscript.sh without doing sudo. Just basing this on the fact you said everything you tried worked in shell and path was set in echo $PATH, but not sudo echo $PATH in your PHP script. Seem

Categories : PHP

Batch file/command to start a program through command line
I'll edit this if you respond to my comment but if you want to simply execute this command via a batch file (and you know nothing about batch files): Open a text editor (e.g.Notepad) Type in your command (e.g. c: andaotherfoldermyprogram.exe 10 20) Save the file as mybatchfile.cmd Double click the file (in Windows Explorer etc.)

Categories : Windows

different order of command line options in a command affecting my output
getoptlong() is doing exactly what it is supposed to do. The format-string "d:g:hv" implies that the parameters d and g require a value. Anything specified following a command-line parameter is consider a value being passed to it. You should run your program as $program --download file --version Checkout this detailed example demonstrating the various aspects of using getoptlong(). How rm can handle the differing position of its cmd-line params? Apparently because rm's parameters (r, v etc.) do NOT accept any values as arguments. Thus directory does not get passed to any of them but rather is a separate cmd-line argument on its own. You can confirm this from the source-code of rm. To do something similar for your program, you will need to modify the optstring to "dghv" a

Categories : C

Defining the command line arguments of a linux command in python
format is your friend: import os, sys if len(sys.argv) == 2: os.system("sudo rtcwake -m off -s {}".format(sys.argv[1])) else: print "usage: ..." so the seconds are command line parameters. Or, you can make it interactive: import os secs = raw_input() os.system("sudo rtcwake off -s {}".format(secs)) to verify that the user input is an integer: try: secs = int(secs) except: print 'usage: '

Categories : Python

Is there a command I can use to sign my modified apk on the command line in Linux?
For this you use standard Java SE tools: jarsigner and keytool. From Android documentation on signing: jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name Remember that you should first sign and then align.

Categories : Android

Trouble running android command in command line
What Am I missing? You are missing two ~ characters, perhaps. The exact path is /Users/me/Development/adt-bundle/ That's not what you typed into your PATH. Your PATH says that there is no /Users/me -- instead, PATH is expecting a /Development directory in the root of your volume. Now, in Linux, the solution would be to add a ~ to indicate that /Development is relative to your home directory: export PATH=${PATH}:~/Development/adt-bundle/sdk/platform-tools:~/Development/adt-bundle/sdk/tools My OS X shell experience is rusty, so I forget if ~ will map to /Users/me or not. If it does, use ~, otherwise, go with: export PATH=${PATH}:/Users/me/Development/adt-bundle/sdk/platform-tools:/Users/me/Development/adt-bundle/sdk/tools

Categories : Android

Remote command execution from command line in Windows XP
Maybe you could do that via Windows Scripting Host (WSH) which supported remote execution. See Setting up Remote WSH. The article contains a link to examples. (You may need to use the WshShell object to invoke taskkill from your remote script.)

Categories : Windows

How Can Be Used the Command Line of Developer Command Prompt in Vim on Windows?
You need to setup your PATH, INCLUDE and LIB environment variables. You could do that by running D:Program Files (x86)Microsoft Visual Studio 10.0VCvcvarsall.bat (or wherever it is located on your installation) in the same prompt you're running vim, or even manually setting these environment variables (here is a list of all values for VS2008 and Windows SDK: Using Visual Studio's 'cl' from a normal command line). However, you just can't run the bat file from vim directly, because it will open another Prompt, so the environment variables will be set only for that new prompt. The other option is just to create bat file which you can put it inside your PATH, for example cvim: call "D:Program Files (x86)Microsoft Visual Studio 10.0VCvcvarsall.bat" "C:Program Files (x86)Vimvim74g

Categories : C++

Insert different text on different pages of a multi page pdf from command line
You could do it by programming in PostScript using Ghostscript. You would need to first find the number of pages in the PDF file or the number of lines in the text file, you might like to check these are the same. Using the Ghostscript pdfwrite device, execute the page description from the PDF file, then read the text form the text file. Position the current point correctly on the content, select an appropriate font and size, and show the text. Then execute showpage to render the page. You can either get one large PDF file with all the pages, or one PDF file per page. Note this is not a task for someone unfamiliar with PostScript programming.

Categories : Linux

Execute batch file. How to call .bat file, visual studio command prompt and change directory in opened command prompt window
You've asked two questions here. You should split them up and ask them as two separate SO questions. Q1. Why is my batch file never getting past call lvsrun.bat? A1. Because call will not return until the batch file it is calling has exited. If you want to launch lvsrun.bat and continue execution immediately, use start. copy "C:dirdbfile" "C:dir1dbfile" cd c:lvsdir start "" "%comspec%" /k lvsrun.bat Q2. Why doesn't the new command window I launch run my test file? A2. Your batch file will only control its command window. If you launch another command window, that one is on its own, you can't "send" commands to it. But you could instead run the test in the current window rather than launching another: :: Use "call" here to run vcvarsall.bat to set up the environment in this pro

Categories : Visual Studio 2010

Command line app: Unix cd command
Because system() executes a command specified in command by calling /bin/sh -c command, and returns after the command has been completed. So each command is executed independently, each in a new instance of the shell. So your first call spawns a new sh (with your current working directory), changes directories, and then exits. Then the second call spawns a new sh (again in your CWD). See the man page for system(). The better solution is to not use system. It has some inherent flaws that can leave you open to security vulnerabilities. Instead of executing system() commands, you should use the equivalent POSIX C functions. Everything that you can do from the command-line, you can do with C functions (how do you think those utilities work?) Instead of system("rm -rf ...") us

Categories : Unix

How is interacting with a prompt of a third party command line program different from a Windows Command prompt?
Most likely the program starts its own shell and does no longer interact with the original one. (You would notice this if the program opens a new window) Or the program needs some specific library to be present to be able to interact with a shell (readline seems to be the case here) and that is not present in your Java Environment. As a quick hack you might try to start bash (or cmd) that then starts the tool. bash and cmd have readline library. I don't have a windows ready here but as a guess just try to call your program like cmd urjtag.exe instead of just urjtag.exe that way you start a cmd process (with that you can interact) and that cmd starts the urjtag.exe where you already know that it can interact with. Either way the problem lies in the way the program you want to call intera

Categories : Java

why "extra characters after command" error shown for the sed command line shown?
It appears that some of the variables are expanding to values that contain a /. Use a different delimiter that isn't contained in any of the variables, e.g. sed 's@dump 0 $2 $3 $4 $5@dump 1 $2 $3 $4 $5@g' base_file.properties (Your first command isn't a valid sed expression.)

Categories : SQL

how to map a command in command line
This is best done with a custom command, not a mapping (assuming you don't want to further edit the command-line): command! -nargs=1 Mf vimgrep /<args>/ c:/branchA/scripts/**/*.sql As a custom command, it has to start with an uppercase letter. The argument is inserted with the <args> special keyword.

Categories : Vim

How to execute a command from C#?
Remove the cmd.exe part and instead place there the path to mogrify.exe and start the parameters with "-crop...", removing the /C If you're passing along path names that contain spaces you'll need to enclose the path with quotes, so the parameters will look like this: "-crop "590x389+116+102!" ""+YourPathHere+""";

Categories : C#

SQL command will not execute in ASP web app
change your code to this and see if see any errors printed: I have added err.description to the message. <% ' Turn error handling on. If an error is generated, our program will continue to execute and ' the error code will be stored in Err.number. On Error Resume Next ' Execute SQL code Call dbConnect() Set result = dbConn.Execute(sqlQry, rowsAffected) ' If an error occured then construct an error message to display to the user If err.Number <> 0 then message="Unable to Perform Update: " 'get the error description from err object message = message & Err.Description & "<br>" 'get errors, if any, from connection object for each objErr in dbConn.Errors message = message & objErr.Descr

Categories : Javascript

unix command line cut and remove new line, unwrap next line
This awk one liner can do it: $ awk '{if ($0 ~ /&$/) {getline a; print $0,a} else {print }}' file it gets the lines ending with & and joins them with the next one. Otherwise just prints the line. Test $ awk '{if ($0 ~ /&$/) {getline a; print $0,a} else {print }}' file A7233334 PALLETS 2 11.000 EACH 2331 Storm Supply 247.5000 2,722.50 2,722.50 4144 Gentro Sales 225.0000 2,475.00 2,475.00 5155 Wacca Outfit 225.0000 2,475.00 2,475.00 6661 Acme Warehouse & Fuller Supply 225.0000 2,475.00 2,475.00 1661 McHugh & Donaldson

Categories : Unix

How to execute a command from C and terminate it
usaually we use system("command"); copy that Entire command into string lets say str ./mjpg_streamer -i "./input_uvc.so -n -f 15 -r 1280x720" -o "./output_http.so -n -w ./www " Into string and then use system(str); //in c code.

Categories : C++

Why won't CloudFormation execute my command?
Your commands block should be nested inside the config block, at the moment it is at the same level in the hierarchy. "AWS::CloudFormation::Init" : { "config" : { "files" : { "c:\Packages\WebDeploy_amd64_en-US.msi" : { "source" : "http://download.microsoft.com/download/1/B/3/1B3F8377-CFE1-4B40-8402-AE1FC6A0A8C3/WebDeploy_amd64_en-US.msi" } }, "commands" : { "1-installwebdeploy" : { "command" : "msiexec.exe /i c:\Packages\WebDeploy_amd64_en-US.msi ADDLOCAL=ALL /qn /norestart" } } }, }

Categories : Amazon



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.