batch-file

How to redirect output of a command to a file of which name is defined in an environment variable?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-15 03:44:07
问题 I want to store absolute path of all the files present under a folder into a text file, let's say temp.txt . I am using this command for this task: dir /s/b/a-d > D:\my work\temp.txt The above command is working fine when I am redirecting to a file name written hard coded into the batch file. But when I am using a variable as shown in below code, I am not getting output redirected to the file temp.txt . @echo off setlocal enabledelayedexpansion REM I am running this script from D:\my work\

edit a specific line in text file using batch command

☆樱花仙子☆ 提交于 2020-01-15 03:08:31
问题 I have a textfile which contains the following text. "Module" { "ModuleSignature" = "8:MergeModule.6F1248514B3047E99E4EE8A129CB8605" "Version" = "8:1.0.0.0" "Title" = "8:uoipmsm" "Subject" = "8:" "Author" = "8:Microsoft" "Keywords" = "8:" "Comments" = "8:" "SearchPath" = "8:" "UseSystemSearchPath" = "11:TRUE" "TargetPlatform" = "3:1" "PreBuildEvent" = "8:" "PostBuildEvent" = "8:" "RunPostBuildEvent" = "3:0" } In the above; I want to change the Version number which I will give when I trigger a

How to create an application in IIS using command line?

我的梦境 提交于 2020-01-15 03:05:27
问题 What would be the equivalent, by command line, of the create button in the Home Directory tab in IIS 6.0 ? (Used to create an application on a directory). Edit : I already know of iidvdir. Unfortunalety, it doesn't seem to work the way I want it to (or I dont use it properly). Let's say that I have a website called Website for witch the root directory is C:\Website. I want to create the application in C:\Website\Application. If i try iisvdir /create Website Application c:\website\Application

Converting Robocopy Batch To VB Script

送分小仙女□ 提交于 2020-01-14 19:53:10
问题 I'm trying to convert a BATCH file I am still working on (question at Robocopy | Mirror Destination Including Source Parent Folder). I've made some progress, and the reason I moved to VB is to add a bit more functionality, like adding a dialog box to ask the user to browse for a folder they'd like to backup... Now the code I currently have (only partially converted from my original .bat file); Dim Command1 Set objShell = CreateObject("Shell.Application") Set objFolder = objShell

Create shortcut that runs a batch file

痴心易碎 提交于 2020-01-14 18:59:06
问题 I want to create a powershell script that creates a shortcut in the windows 7 taskbar, that runs a batch file from cmd.exe. Trying to do as told in these two posts: https://superuser.com/questions/100249/how-to-pin-either-a-shortcut-or-a-batch-file-to-the-new-windows-7-taskbar How to create a shortcut using Powershell Basically I want to set a shortcut files Target property to be something like: C:\Windows\System32\cmd.exe /C "C:\Dev\Batch files\cmake-guiMSVC1064bit.bat" What I got so far in

Create shortcut that runs a batch file

混江龙づ霸主 提交于 2020-01-14 18:58:28
问题 I want to create a powershell script that creates a shortcut in the windows 7 taskbar, that runs a batch file from cmd.exe. Trying to do as told in these two posts: https://superuser.com/questions/100249/how-to-pin-either-a-shortcut-or-a-batch-file-to-the-new-windows-7-taskbar How to create a shortcut using Powershell Basically I want to set a shortcut files Target property to be something like: C:\Windows\System32\cmd.exe /C "C:\Dev\Batch files\cmake-guiMSVC1064bit.bat" What I got so far in

Batch Write to Text File with <Angle Brackets>

╄→гoц情女王★ 提交于 2020-01-14 18:51:13
问题 I am attempting to dynamically create a small XML file with a Batch Script, but am having issues writing lines that begin and end with angle brackets. 1) If I do something like: set foo=^<bar^> echo %foo% > test.txt This results in > was unexpected at this time. echo <bar> > test.txt 2) If I surround the echo statment variable with quotes: echo "%foo%" > test.txt , it writes successfully to the text file. However it obviously includes the quotes which I can't have. 3) Then I thought "Well, it

How to embed a text file in a Windows batch file [duplicate]

旧时模样 提交于 2020-01-14 18:46:49
问题 This question already has answers here : heredoc for Windows batch? (18 answers) Closed 3 years ago . I need to create a batch file that writes a text file (possibly including variables). In Unix with bash this is trivial: #!/bin/bash ver="1.2.3" cat > file.txt <<EOL line 1, ${ver} line 2 line 3 ... EOL What is the simplest way to do this with a batch file? Note: there is a complete solution using an 'heredoc' routine at heredoc for Windows batch? but it seems too complex for ad-hoc use. I'm

C# Winforms and command line batch files

会有一股神秘感。 提交于 2020-01-14 13:59:08
问题 I have this running from my c# winforms app: string ExecutableFilePath = @"Scripts.bat"; string Arguments = @""; if (File.Exists(ExecutableFilePath )) { System.Diagnostics.Process.Start(ExecutableFilePath , Arguments); } When that runs I get to see the cmd window until it finishes. Is there a way to get that to run without showing it to the user? 回答1: You should use ProcessStartInfo class and set the following properties string ExecutableFilePath = @"Scripts.bat"; string Arguments = @""; if

Rscript does not recognize setGeneric function

烈酒焚心 提交于 2020-01-14 13:46:07
问题 I am trying to convert an R script into something that a client can run in batch mode. My code uses generic functions and one snippet which is near the beginning goes like: setGeneric("testInput", function(inputData, params = list()) standardGeneric("testInput")) I've been using R CMD BATCH and it works fine. However I couldn't find an easy way to make my script print the output on the console, so based on that (and suggestion that Rscript.exe is the "proper" way to run R batch files) I