cmd

Excluding a directory in for loop's search

五迷三道 提交于 2020-01-17 10:17:09
问题 I have the following line of code: FOR /R D:\1_FOLDER %f IN (*.jpg,*.png) DO XCOPY %f D:\2_FOLDER /H /C The first problem what i have, the command doesn't run, i get the error Invalid numbers of parametres The second problem in directory 1_FOLDER i have 2 more folders X_FOLDER and Y_FOLDER, i want the for loop to search only in X_FOLDER, and copy only files of the X_FOLDER. I have the second problem same when i want to copy from C:\ , i want to exclude the Windows folder from for loop's

How to count characters in a text file using batch file

旧巷老猫 提交于 2020-01-17 09:11:08
问题 I want to count all the characters of a certain text. However in my code it only counts single string. But the requirement needs to count all characters including whites spaces and new line.. For example: Hello World! How are you today? Hope you are okay How am i going to do that in my code?Thanks. My code: @ECHO OFF for %%i in (y.txt) do @set count=%%~zi REM Set "string" variable SET string=(Hello World How are you today? Im fine..) // i want to read these string because my code only read

calling java methods from a terminal

ぐ巨炮叔叔 提交于 2020-01-17 08:32:25
问题 Suppose I have a java program, myProgram.jar , which I have running on a server. To start the program I would type this into the terminal: >java -jar myProgram.jar and the program would continue to run indefinitely. Now what about if the program had a function such as void processInput(String text){ //process the text } and I wanted to SSH into the server and call this function with a particular string? so I could log into my server at any time and alter the state of my program. Is this

Input redirects not working with batch file prompts

烂漫一生 提交于 2020-01-17 06:00:02
问题 I have a batch file that I am trying to automate using input redirects from a file. The general idea of the batch file is to copy files over based on a yes or no response. First, the user is prompted which version they would like to pull the files from. Following that, the user is prompted if they would like to install the different files. If the user chooses yes, the next prompt is delayed due to the file being copied. Here as an example of the output: Please enter the release version (ex:53

File comparison using command prompt

只愿长相守 提交于 2020-01-17 00:34:08
问题 I wanted to compare two text files using command prompt and I am using two text files with name abc and xyz. I need unique records in other text file. But the output which I get for some string are going on to second line which breaks my urls into two separate lines is there any way to compare them and get output in the same format which in the existing text file. fc abc.txt xyz.txt > unique.txt abc File contains data as below newsroom.associatedbank.com/News-Releases/Associated-Bank-opens

Random number generator not random in a batch file

假如想象 提交于 2020-01-16 08:49:08
问题 Trying to generate a random number and use it for variable value in Windows batch script file. Maybe I am missing something very basic, but something is not working here for me. Created a batch file named random_test.bat with the following content. SET rnumber=%random% echo %random% pause Running the file consecutively three times produces the following set of outputs: One C:\Users\user\Desktop>SET rnumber=28955 C:\Users\user\Desktop>echo 20160 20160 C:\Users\user\Desktop>pause Press any key

How to run multiple commands in one line using cmd in windows 10

陌路散爱 提交于 2020-01-16 08:49:06
问题 as the title said I need to run exactly two commands in one line using cmd in windows 10. How is it possible? 回答1: to run two commands use & . Both commands will be executed: dir file.txt & echo done Use && to execute the second command only if the first command was successful: dir existentfile.txt && echo done Use || to run the second command only if the first command failed: dir nonexistentfile.txt || echo not found You can combine: dir questionablefile.txt && (echo file exists) || (echo

No longer able to run some commands in CMD - Access is Denied [closed]

≯℡__Kan透↙ 提交于 2020-01-16 08:26:28
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed yesterday . This morning I was able to view all scheduled tasks: > schtasks.exe /query /fo LIST /v and delete scheduled tasks I've created: > Schtasks /delete /TN "taskname" All of the sudden, I get "This app can't run on your PC. To find the version of your PC check with the software publisher" while running same commands. I

Excel VBA Shell command with spaces in file path

你。 提交于 2020-01-16 05:15:08
问题 Public Sub openEntryFiles() Dim filePath, shellCommand, agingsEntry, invenEntry As String filePath = Range("CustomerPath").Value2 & "\files\" agingsEntry = "agings\entry_EP.bat" invenEntry = "inven\entry_EP.bat" shellCommand = """%ProgramFiles(x86)%\TextPad 5\TextPad.exe"" -r -q -u """ & filePath & agingsEntry & """ -u """ & filePath & invenEntry & """" Debug.Print shellCommand Shell shellCommand, 0 End Sub I am trying to write a subroutine that will run a shell command with spaces in the

Why is my piping failing?

亡梦爱人 提交于 2020-01-16 02:12:10
问题 I've been messing around with .cmd scripts, and wanted to practice piping. I wrote one script to make files, and another to edit them with Notepad++. The making script (called create.cmd) is as follows: @echo off copy nul %1 > nul echo %1 And the edit script (called edit.cmd) is as follows: @echo off start notepad++.exe %1 Now, I wanted to try and make a file, and then pipe its output (hence the echo line) in the form of the name of the file to the edit script. So what I wrote was this: