w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
how to get access after hide the drive with Diskpart Command-Line Utility
You can use the volume GUID like this: \?Volume{2a0b16cf-f76a-11df-9310-806e6f6e6963}pathfile.ext Note that only the Unicode file functions will accept this sort of path, and the syntax has to be strictly correct. For example, you can't use forward slashes instead of backslashes. I'm not sure how best to enumerate the volume GUIDs. One method is QueryDosDevice but I expect there are better ways.

Categories : C

External command-line process never returns
I think you probably just need to call Dim ret = myOutput.ReadToEnd before proc.WaitForExit(). MSDN warns about a deadlock from calling WaitForExit() first: "A deadlock condition can result if the parent process calls p.WaitForExit before p.StandardOutput.ReadToEnd and the child process writes enough text to fill the redirected stream. The parent process would wait indefinitely for the child process to exit. The child process would wait indefinitely for the parent to read from the full StandardOutput stream." So I'm guessing those 3/81 files just have more output than the others.

Categories : Dotnet

Compiling arrays stored in external text files (C++ compiled using command line g++)
Here's how I'd structure this: file: data.array /* C++ style comments are ok in this file and will be ignored * both single and multiline comments will work */ // the data in the array is a comma seperated list, lines can be any length 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, // more comma seperated data 9996, 9997, 9998, 9999 file: class.h extern int myArray[]; // you should fill in the size if you can // more stuff here file: class.cpp // if you have an editor that highlights syntax and errors, it may not like this // however, #include is handled before compiling and performs a blind substitution // so this is perfectly legal and should compile. // Visual C++ 2010 highlights this as an error, but the project builds fine. int myArray[] { #include "data.arr

Categories : C++

python program works fine from command line and as git difftool, but dies as external-diff
Thanks for the tip, @ThomasFenzl, indeed git was running python 2.7.2 while from the command line it is running 2.7.5. Still not completely sure why it can't find the ipdb lib dir, but it was a good starting point for sure. Apparently the use of #!/usr/bin/env python as opposed to specifying the exact python binary path (which on my system is the canonical /usr/local/bin/python) causes it when run from git to grab the system's original python. I think I still need to fall back to the /usr/bin/env python method though because one of the environments I need this on only has python installed in my user directory.

Categories : Python

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

Unmount my external hard drive in bash
Searching for "Unmount Hard Drive Terminal" yields http://ubuntuforums.org/showthread.php?t=842698 as the first result. >.> russlar provides a solution: open terminal, and run df -h. this will tell you all the hard drives mounted. then, run sudo umount /dev/something, where somethign is the name of the hard drive that you want to unmount. Nothing wrong with asking, but when a solution is on the first Google result, it's a little... odd.

Categories : Misc

Will SQL Server treat a USB 3.0 External Drive as local?
I just used a USB 2.0 drive the other day to perform a restore to a test environment. I imagine that as long as Windows identifies the drive as a local disk and not removable storage, and the SQL Server service can access the directory, it should work just fine.

Categories : Sql Server

Google Drive: read-only without authorisation on external site
It is be possible for a third party app to authorize requests without an access token. You can make requests from an allowed referrer/IP with an API key. https://developers.google.com/console/help/#generatingdevkeys Then, you should be allowed to GET the following public file: GET https://www.googleapis.com/drive/v2/files/1T_fVTiyyBVnfYKd_3gZzVfxqU5NbOhIlEG0nyReYh9w?key=[yourKey]

Categories : File

How to remove file permissions on linux from an external hard drive?
To make the partition accessible under Linux run: sudo chmod -R 777 /media/<drive-name>/ this should make the mac drive accessible for you. Changing ownership would do about the same, but you need not worry about it.

Categories : Linux

Call an external command in python and inserting values into the command
You have some trouble with single/double quotes. os.system('java -jar GeoNetCWBQuery-4.0.2-bin.jar -s "NZMQZ..HH..." -d 3600 -event:time ' + date + time + ' -event:lat ' + lat + ' -event:lon ' + lon + ' -event:depth ' + depth + ' -o %c%s%y%M%D%z') Also, as Udo Klein notes you should not use os.system anymore, prefer subprocess.call. If you are going to change os.system to subprocess.call you code will look like: subprocess.call('java', ['-jar', 'GeoNetCWBQuery-4.0.2-bin.jar', '-s', 'NZMQZ..HH...', '-d', '3600', '-event:time', date, time, '-event:lat', lat, '-event:lon', lon, '-event:depth', depth, '-o', '%c%s%y%M%D%z'])

Categories : Python

Change my current working directory in Python to my external hard drive.
You are correct. >>> 'E:CollegeProject3dlife-gc-2013-dataset-hhi3dlife-gc-2013-dataset-hhi' 'E:\College\Projectx03dlife-gc-2013-dataset-hhix03dlife-gc-2013-dataset-hhi' Double the backslashes, use forward slashes, or use a raw string.

Categories : Python

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

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 search for a folder in all the available windows drive using the command prompt?
See if this works for you: it will report the last match found. @echo off for %%a in (c d e f g h i j k l m n o p q u r s t u v w x y z) do ( if exist "%%a:" dir %%a: /ad /b /s >>"%userprofile%desktopfolderlist.txt" ) find /i "opencvuildin" < "%userprofile%desktopfolderlist.txt" >"%userprofile%desktopfolderlistfound.txt" if exist "%userprofile%desktopfolderlistfound.txt" ( for /f "usebackq delims=" %%a in ("%userprofile%desktopfolderlistfound.txt") do ( set "foundfolder=%%a" echo found at "%%a" ) ) if defined foundfolder ( echo last folder matched at "%foundfolder%" ) else ( echo didn't find the "opencvuildin" )

Categories : Windows

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

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

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

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

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

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

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

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

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

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

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

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

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++

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

how to read multiline output command line by line, in a shell script?
Maybe I found a different solution, where I can use variables also outside the loop I have to change the default IFS to newline echo Searching for android virtual devices ... IFS=$' '; for l in $(${PROGDIR}/android list avd) ; do VAR1=$(echo $l | cut -d: -f1 | sed -e 's/s*//'); #sed removes trailing blanks if [ $VAR1 == "Name" ]; then NUM_AVD=$(($NUM_AVD+1)); fi; done echo "NUM_AVD=$NUM_AVD" In this case NUM_AVD is correctly 2

Categories : Shell

Reading input files by line using read command in shell scripting skips last line
DONE=false until $DONE do read line || DONE=true echo $line done < blah.txt How to use `while read` (Bash) to read the last line in a file if there’s no newline at the end of the file?

Categories : Bash

How to get command line output snippet if I know the line number in Windows?
Here's one way of doing it with a batch file, although it's not a very elegant solution. @echo off setlocal set currentservice="" set servicestate="" sc query state= all > services.txt for /f "delims=:; tokens=1,2" %%a in (services.txt) do call :findservice "%%a" "%%b" del services.txt echo %servicestate% endlocal goto :end :findservice if not %1 == "SERVICE_NAME" goto :findstate set currentservice=%2 goto :end :findstate if not %1 == " STATE " goto :end if not %currentservice% == " Telnet" goto :end set servicestate=%2 goto :end :end It first writes out the result of the sc query to a temporary file (services.txt). It then uses a for loop to process each line of that file. When it find a line starting with SERVICE_NAME, it saves the value of that name in t

Categories : Windows

Read all files line by line in a directory and do a command on them
If you want to save the file names in a variable, use array=(a b c) syntax to create an array. There's no dollar sign. Then loop over the array with for item in "${array[@]}". To read from a file with a while read loop, use while read; do ...; done < "$file". It's odd-looking, but the file is redirected into the loop as a whole. files=(/dos2unix/*.txt) for file in "${files[@]}"; do while IFS=',' read -ra line; do ... done < "$file" done Another way is to use cat to concatenate all the files together, which lets you get rid of the outer for loop. cat /dos2unix/*.txt | while IFS=',' read -ra line; do ... done

Categories : Bash

How to use command prompt using c# and getting the results line by line?
I think you have to use a dedicated thread to read every new line from the StandardOutput stream, something like this: //This will append each new line to your textBox1 (multiline) private void AppendLine(string line) { if (textBox1.InvokeRequired){ if(textBox1.IsHandleCreated) textBox1.Invoke(new Action<string>(AppendLine), line); } else if(!textBox1.IsDisposed) textBox1.AppendText(line + " "); } //place this code in your form constructor Shown += (s, e) => { new Thread((() => { while (true){ string line = CMDProcess.StandardOutput.ReadLine(); AppendLine(line); //System.Threading.Thread.Sleep(100); <--- try this to see it in action }

Categories : C#

Run external command from within Perl
Your usage of system and start is OK. From your description in the comment, I think it's because you're not using the correct escaping method when giving configure files to doxygen that it throw such error: Error: configuration file C:SERSGHOSHBCD not found! Try with my $result = `doxygen C:\Users\aghosh\abcd`; In the two back-slashes, the former one is to escape the latter one so that it's recognized by windows as directory separator.

Categories : Windows

Calling an external command in GO
You need to use the exec package : start a command using Command and use Run to wait for completion. cmd := exec.Command("yourcommand", "some", "args") if err := cmd.Run(); err != nil { fmt.Println("Error: ", err) } If you just want to read the result, you may use Ouput instead of Run.

Categories : Go

How to execute an external command in Vim script?
You can use the :! vim command. For example, to echo 'Hello, World!' from inside vim (and therefore from within a vim script, also), type :! echo 'Hello, World!' in vim. Or, in a vim script, you can put just ! echo 'Hello, World!' The reason you need the before the ! is because vim performs special handling of ! characters in the argument of a ! command. If you were running a command that does not include any ! character, then you do not need to escape it. If you want to read more in depth about this, you can type :help :! in vim, as @FDinoff said.

Categories : Vim

How to catch external command failure
plink failing doesn't throw a (PowerShell) error and thus doesn't increment the $error count. Check $LastExitCode if you want to detect whether the command succeeded or failed. As for someone "messing up the Excel sheet": how exactly does the script fail in that case? Handling this error will depend greatly on the actual error. The host key issue can be handled by echoing "y" into the command: "y" | &$process -ssh -l $loginname[$counter] ... or by writing the key to the registry before running the command: $key = "HKCU:SoftwareSimonTathamPuTTYSshHostKeys" $val = 0x23,0x3857aee9..." Set-ItemProperty $key "rsa2@22:$($FQDN[$counter])" $val &$process -ssh -l $loginname[$counter] ... Running plink against a non-existing FQDN did not raise a terminating error in my tests: P

Categories : Powershell

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

grails is not recognized as an internal or external command
I have faced the same problem and did as follows to get rid off. Although you have already mentioned that, you set Environment variables. I am assuring again: In environment variables dialogue: (user variables section) 1. Set GRAILS_HOME to your extracted grails version as GRAILS_HOME=D:GrailsEnvironmentgrails-2.1.1 2. Set JAVA_HOME to your installed jdk version as JAVA_HOME=C:Program FilesJavajdk1.7.0_04 In environment variables dialogue: (System variables section) 1. Edit path and add D:GrailsEnvironmentgrails-2.1.1in 2. Edit path and add C:Program FilesJavajdk1.7.0_04in If needed reboot your pc again. and in command prompt run 'grails -version' and 'java -version' command to check whether grails and java were perfectly installed. If error shows then may be your grails package i

Categories : Grails

Launching an external script with source command
This code sources the file config contained in the same path of the script real path. Let's explain the code: if [ -L $0 ] then source `readlink -e $0 | sed "s:[^/]*$:config:"` else source `echo $0 | sed "s:[^/]*$:config:"` fi As you say in your question, if [ -L $0 ] checks if the script name ($0) is a link or not. readlink -e $0 returns the target of the link: $ ln -s a mylink $ ls -la lrwxrwxrwx 1 me me 1 Sep 5 11:59 mylink -> a $ readlink -e mylink /home/me/test/a Being /home/something/script.sh the script real path, with sed "s:[^/]*$:config:" will replace everything after last / with config: $ echo "hjio/hi/hi" | sed "s:[^/]*$:config:" hjio/hi/config So what it is doing is to source the file config contained in the same path of the script.

Categories : Shell



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