command-line-arguments

Getting the arguments passed to a executable using wmic

孤街浪徒 提交于 2019-12-24 17:24:32
问题 I am trying to get commandline arguments of an executable which was launched by another program. I tried the command mentioned in this answer, but I can't understand the syntax :( I am trying to get the commandline arguments of an process, I have the PID & the process name, In this case I am trying get arguments of an ping command which I am using to test the command... Thanks in Advance :) 回答1: Try this: wmic process where "name='ping.exe'" get commandline /format:list Or if you prefer to

How do I pass command line arguments to a path-independent Python script using Windows?

我们两清 提交于 2019-12-24 16:14:33
问题 I'm using Python to write various command-line scripts to process seismic data. The data that is processed is in many different directories, representing data from many different seismometers. I need to have some path independence for the scripts so that I don't have to always copy, cut, and paste the scripts into the directory containing the data. To that end, I've tried to set the path in the system environment in order to make the scripts runnable from anywhere. Tis is the method I chose

CUDA: Passing parameters to host compiler during Nsight session

被刻印的时光 ゝ 提交于 2019-12-24 15:34:28
问题 I have a cuda (v4.2) program running under visual studio 2010, to which I pass various command line parameters. I want the host compiler to see the same parameters when I run through nsight (v2.2). I assume I have to do this via (right click project) -> nsight user settings->command line arguments, but haven't yet managed to find a syntax that doesn't crash nvcc. I'm assuming it's arranged around "--run-args " somehow? ** Clarification, after comment below: Sure when you debug straight

How to return the full path from a command line argument

萝らか妹 提交于 2019-12-24 14:53:18
问题 I have an application that can be run from Explorer, and passes the selected directory to the application. So I can use the following code: private void frmMain_Shown(object sender, EventArgs e) { //open the dir DirectoryInfo d = new DirectoryInfo(cmdArgs); SelectDirectoryInTree(d); } This however fails if the user selects a Special Folder. The path returned for these folders is different. So, for example, if the user selects Libraries\Documents folder, (or any other folder in there) the

Batch file for changing cmd directory and pre-filling a command

☆樱花仙子☆ 提交于 2019-12-24 13:56:04
问题 I've searched long and hard to get details on this, with no luck. All I want to do is: open CMD change my working directory enter a text string command, and pause there so I can manually enter the last portion of the command and press enter Example: @ECHO OFF start cmd.exe /K "cd C:\ProgramData\Microsoft\Windows\Start Menu" I have the first half of it working fine, it opens cmd and changes the directory - but how do I fill in the text string into the window at this point? 回答1: Ok, you want to

can't pass arguements using argparse and python 3.4.2 on Windows 7

让人想犯罪 __ 提交于 2019-12-24 13:53:00
问题 I've upgraded to Python 3.4.2 and argparse (from optparse) but neither appears to recognise command line options. As a simple test I run this; #test_argparse.py def main(): import argparse parser = argparse.ArgumentParser(description='Execute database query.') parser.add_argument("-q", "--query", dest="query", help="Name of the query file to be run") args = parser.parse_args() print(args) if __name__ == '__main__': main() From the command line, when I run test_argparse.py -q get_msre_for_book

The simplest possible getopt program I can get?

扶醉桌前 提交于 2019-12-24 13:24:04
问题 After doing some reading on this link on how to use getopt() , I'm trying to get a small example. What I want, is something like: ./prog -v # show me prog version ./prog -f filename # just show me the filename I entered from the command line Here is what I wrote so far: #include <stdio.h> #include <unistd.h> #include <stdlib.h> int main(int argc, *argv[]) { char VER[] = "0.1.1"; int opt; opt = getopt(argc, argv, "vf:"); char *filename; while (opt != -1) { switch(opt) { case 'v': printf(

Process Builder won't accept ffmpeg arguments

时光总嘲笑我的痴心妄想 提交于 2019-12-24 13:14:18
问题 I'm trying to open a process (ffmpeg) using the Java ProcessBuilder. So far so good but I can't really pass any arguments to the process. The ProcessBuilder just won't use the right arguments. Here's my code so far: ProcessBuilder builder = new ProcessBuilder("ffmpeg/ffmpeg.exe", "-i " + this.inputFile.getAbsolutePath(), "-c:v libvpx", "-minrate " + iBitrate + "k", "-maxrate " + iBitrate + "k", "-b:v " + iBitrate + "k", "-c:a libvorbis", this.outputFile.getAbsolutePath()); A sample output I

How to use Apache Commons CLI to parse the property file and --help option?

99封情书 提交于 2019-12-24 12:57:57
问题 I have a property file which is like this - hostName=machineA.domain.host.com emailFrom=tester@host.com emailTo=world@host.com emailCc=hello@host.com And now I am reading the above property file from my Java program as shown below. I am parsing the above property file manual way as of now - public class FileReaderTask { private static String hostName; private static String emailFrom; private static String emailTo; private static String emailCc; private static final String configFileName =

Search and Edit a file with a Batch file

别等时光非礼了梦想. 提交于 2019-12-24 11:35:48
问题 I would like to be able to edit a txt file with a batch file. This is a bit complicated by a number of things. First, the file name is frog.properties and opens just fine in notepad but on the computers this will be run on; the file type of .properties is not associated with Notepad. If the file needs to it can make the association but I'd like to avoid that. Second, the text that needs edited is a single line in the file. The first 9 characters on the line we want to edit are unique to that