command

Linux cmd to search for a class file among jars irrespective of jar path

此生再无相见时 提交于 2019-12-02 14:09:54
I want to search for a particular class file among many jar files without giving the location of each jar file. Is this possible with a simple command? I tried this command: grep Hello.class *.jar Which did not return a list of jars containing the class. Then I ran the command: grep Hello.class /full/path/of/jar/file/*.jar Which did return the relevant jar file. Is there a better way? Where are you jar files? Is there a pattern to find where they are? 1. Are they all in one directory? For example, foo/a/a.jar and foo/b/b.jar are all under the folder foo/ , in this case, you could use find with

Linux - Replacing spaces in the file names

断了今生、忘了曾经 提交于 2019-12-02 13:53:06
I have a number of files in a folder, and I want to replace every space character in all file names with underscores. How can I achieve this? neesh This should do it: for file in *; do mv "$file" `echo $file | tr ' ' '_'` ; done I prefer to use the command 'rename', which takes Perl-style regexes: rename "s/ /_/g" * You can do a dry run with the -n flag: rename -n "s/ /_/g" * Use sh... for i in *' '*; do mv "$i" `echo $i | sed -e 's/ /_/g'`; done If you want to try this out before pulling the trigger just change mv to echo mv . What if you want to apply the replace task recursively ? How would

Batch: During my code loop it stops setting a variable. All Help Welcome

与世无争的帅哥 提交于 2019-12-02 12:48:58
问题 goto time :time set tm=%time% set hh=%tm:~0,2% set mm=%tm:~3,2% set ss=%tm:~6,2% set ms=%tm:~7,2% goto date :date set dt=%date% set wd=%dt:~0,3% set mh=%dt:~4,2% set dy=%dt:~6,2% set yr=%dt:~8,4% goto scheduletimes :scheduletimes goto hour1 :hour1 for /f "tokens=1*delims=0" %%a in ("$0%hh%") do set /a "HH"="%%b" if %HH% equ 6 goto minutes1 pause goto time :minutes1 for /f "tokens=1*delims=0" %%a in ("$0%mm%") do set /a "MM"="%%b" if "%MM%"=="00" goto seconds1 pause goto time :seconds1 for /f

FSUTIL in GB space left

时光总嘲笑我的痴心妄想 提交于 2019-12-02 11:35:16
I got a batch file that does the following. echo Server 1 C:\>>output.txt fsutil volume diskfree \\IPISHERE\d$>>output.txt echo ---------------------------------------------------------- >>output.txt This then displays data as Total # of free bytes : 71942455296 Total # of bytes : 131623546880 Total # of avail free bytes : 71942455296 Please can some one help so I can convert it in to GBs? @echo off setlocal EnableDelayedExpansion for /F "tokens=1* delims=:" %%a in ('fsutil volume diskfree C:') do for %%c in (%%b) do ( set "D=%%c" set /A "D1=!D:~0,-8!,D2=1!D:~-8,-4!-10000,D3=1!D:~-4!-10000"

Executing commands by using Telnet in C# [duplicate]

别说谁变了你拦得住时间么 提交于 2019-12-02 11:23:30
Possible Duplicate: C# Telnet Library I wish to do telnet programatically using C# so that once I establish the connection to the server, I can execute the commands like ls, ls -l, mv, rm.. etc on the server. Is it possible? Are there classes in C# for this purpose similar to the classes for FTP (FtpWebRequest)? If yes, please direct me to the right approach. When I execute ls , I need the list generated on server to be sent to the client i.e. windows machine in my case. Yes, here you have a telnet library http://www.codeproject.com/KB/IP/MinimalisticTelnet.aspx 来源: https://stackoverflow.com

Android Root execute su with parameters

一个人想着一个人 提交于 2019-12-02 11:16:53
I ve got a problem, executing su with parameters (containing blank space?!). My Command.java looks like this: public class Command { Process process; public String executeCommand(String command) { StringBuffer output = new StringBuffer(); try { process = Runtime.getRuntime().exec(command); process.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = ""; while ((line = reader.readLine())!= null) { output.append(line + "\n"); } } catch (Exception e) { e.printStackTrace(); } String response = output.toString(); return response; } }

Is there a command in java to make the program go back to the beginning of a loop

只愿长相守 提交于 2019-12-02 11:16:13
问题 I am trying to make a typing adventure kind of game in java, however i need a command at least similar to the one in the title, here is the code import java.util.Scanner; public class MyFirstGameInJava { public static void main(String[] args) { System.out.println("Greetings, Enter your name and you may start your quest!"); Scanner Username = new Scanner(System.in); String name = Username.nextLine(); System.out.println("Greetings " + name ); System.out.println("Welcome to an Unnamed Typing

How do i send DOS commands to my Receipt printer via COM1? [closed]

孤街浪徒 提交于 2019-12-02 10:21:46
How do i send DOS commands to my Receipt printer via COM1? Im currently devoloping a Cash register software, and i ran into an issue using the receipt printer. i need to be able to send hexidecimal commands to the printer via DOS. so far i've tried to do the following. Open CMD input Copy con: com1 input a hexidecimal number press Ctrl + Z press Enter this according to what i've read should send the hexidecimal number as a command to he printer. but instead it just sends the number as a string and prints out the text. some info on the printer im using: TPG A794 receipt printer. a manual on the

csh script: check if command exists

混江龙づ霸主 提交于 2019-12-02 09:15:38
问题 I would like to have something like this if (command_not_exists) exit Can someone tell me how to achieve this functionality in a cshell script? 回答1: My problem is solved using where command (I was trying with which command). Solution: if(`where test_cmd` == "") then printf "\ntest_cmd: Command not found\n"; exit(1); endif Thanks 来源: https://stackoverflow.com/questions/22040308/csh-script-check-if-command-exists

How to open a command prompt and input different commands from a java program

为君一笑 提交于 2019-12-02 08:54:27
问题 I need to open a command prompt & execute ij.bat , which will take me to another prompt, where I can give command to connect to DB & later different sql statements. I was able to execute ij.bat from the java program like Process process = Runtime.getRuntime().exec("D:\\ij.bat"); But how to give the furthur set of commands through the java program? 回答1: You can use this exec public Process exec(String command) throws IOException Also visit This Link 回答2: Instead of trying to run ij.bat, and