batch-file

Using FOR or FORFILES batch command to individually archive specific files

我与影子孤独终老i 提交于 2020-01-22 02:19:07
问题 I have a set of .iso files in different directories and sub-directories: <folder1> app1.iso app2.iso app3.iso <subfolder1> app1a.iso app2a.iso <subfolder2> app2b.iso app3b.iso <folder2> app4.iso app5.iso <subfolder5> app20.iso Using a batch file and having 7-zip pre-installed (with PATH environment variable configured), I want to be able to archive each .iso to it's own individual .7z archive file. I don't want to archive all .iso's in a current folder into one archive. I attempted to create

Backup and upload to FTP server [closed]

浪子不回头ぞ 提交于 2020-01-21 10:33:34
问题 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 4 years ago . Can anyone direct me to a script solution that makes a backup of a directory and uploads it to an ftp server? I was searching for a batch script initially but any solution would do, as long as it is open source. Thanks in advance, Jean 回答1: I'll be working on one soon, but WinSCP has a CLI that you can use to

Batch Files: List all files in a directory, print as .txt and place output file in all sub directories

青春壹個敷衍的年華 提交于 2020-01-21 10:33:26
问题 1. Searched everywhere, I do find tutorials to print list of files in directory and sub directories using dir command as follows: @echo off dir /S > list.txt pause Above code will return all files in list.txt. We can use switches to get lists in various formats. What I am trying to do is: When I run batch file output file list.txt should be placed in all Sub Directories and not only in the directory from batch file is being executed. 2. I am trying to to rename list.txt as %current directory

Batch Files: List all files in a directory, print as .txt and place output file in all sub directories

谁都会走 提交于 2020-01-21 10:33:23
问题 1. Searched everywhere, I do find tutorials to print list of files in directory and sub directories using dir command as follows: @echo off dir /S > list.txt pause Above code will return all files in list.txt. We can use switches to get lists in various formats. What I am trying to do is: When I run batch file output file list.txt should be placed in all Sub Directories and not only in the directory from batch file is being executed. 2. I am trying to to rename list.txt as %current directory

How to properly escape quotes in powershell v2?

时间秒杀一切 提交于 2020-01-21 05:52:10
问题 How do you properly escape quotes in powershell v2 (called from within a batch file)? I have tried: powershell -Command "(gc file1.txt) -join "`n" | Out-File file2.txt" and powershell -Command "(gc file1.txt) -join ""`n"" | Out-File file2.txt" and powershell -Command "(gc file1.txt) -join '"`n`" | Out-File file2.txt" but they all fail. Editor's note : The purpose of the command is to transform Windows CRLF line breaks to Unix LF-only ones, so as to create a file that will be processed on

Change output of pause command in batch script

二次信任 提交于 2020-01-20 17:14:28
问题 I'm writing a Windows batch script. By default, the pause command will pause the script and display the text "Press any key to continue..." . How do I modify this text to display my own text to the user? Thanks. :) 回答1: You could hide the text from the pause command by using this: pause >nul Then you could echo your own message to tell the user it has paused: echo The batch file has paused So the full script might look like this: @echo off echo Hello World! echo The batch file has paused

Change output of pause command in batch script

点点圈 提交于 2020-01-20 17:11:57
问题 I'm writing a Windows batch script. By default, the pause command will pause the script and display the text "Press any key to continue..." . How do I modify this text to display my own text to the user? Thanks. :) 回答1: You could hide the text from the pause command by using this: pause >nul Then you could echo your own message to tell the user it has paused: echo The batch file has paused So the full script might look like this: @echo off echo Hello World! echo The batch file has paused

Find and rename files with no extension?

半城伤御伤魂 提交于 2020-01-20 01:40:49
问题 So, I've got a bunch of files with no extension. I want to write a windows batch script that will: Find files with no extension (in a specified folder) Add .bla to the end of the file name I'm such a windows batch script noob I don't even know where to start. Suggestions? 回答1: For windows batch files, this will rename only files with no extension to the .bla extension: rename *. *.bla Notice the first argument is a star and a dot: *. The second argument is: *.bla The start dot (*.)

How to input a string from user into environment variable from batch file

荒凉一梦 提交于 2020-01-20 00:30:16
问题 I want to prompt the user for some input detail, and then use it later as a command line argument. 回答1: You can use set with the /p argument: SET /P variable=[promptString] The /P switch allows you to set the value of a variable to a line of input entered by the user. Displays the specified promptString before reading the line of input. The promptString can be empty. So, simply use something like set /p Input=Enter some text: Later you can use that variable as argument to a command: myCommand

How to Open only UserForm of an excel macro from batch file

两盒软妹~` 提交于 2020-01-19 06:09:44
问题 I'm trying to open the UserForm1 of an excel macro through batch file. I'm able to open that but excel is also getting opened along with that. I want only UserForm1 to be opened not the excel. Below is my approach : I have written a macros to open the UserForm1 Sub open_form() UserForm1.Show End Sub In batch File: @echo off cd "c:\Test\" openFormTest.xlsm By the above approach, When I'm running the batch file both UserForm1 and excel are getting open, but I want to open only UserForm1. Kindly