A batch file is the name given to a type of script file, a text file containing a series of commands to be executed by the command interpreter under MS-DOS and Microsoft Windows.

learn more… | top users | synonyms (1)

2
votes
1answer
25 views

Trouble using powershell output as a variable in batch file

I can manually run this command from a Windows Command Prompt: powershell (new-timespan -start 01/01/2000 -end (get-date)).days % 14 And it returns a number from 0 to 13. I want to use this result ...
-2
votes
0answers
20 views

Have a windows 7 Task scheduled batch run as a regular-user johndoe which starts an exe on johndoe login, how to prevent his killing of process?

I am starting a script from Windows Task scheduler as a regular-user johndoe and my script starts an exe that runs in background when johndoe user logs in and I want to prevent user from "killing" the ...
-3
votes
0answers
50 views

include several key within vbs [closed]

Re-edit the question (Update Jul 12) I have this example.vbs (for purposes of example only) On Error Resume next Const HKEY_LOCAL_MACHINE = &H80000002 strAnswer = MsgBox("Press Yes to disable ...
0
votes
2answers
97 views

vbs to detect usb drive and run some commands [closed]

I have two scripts. Both are within the same folder on the hard disk. The "vbs" call "bat" to detect usb to run some commands. I want to incorporate the function of selecting the usb to vbs. Thanks ...
1
vote
1answer
51 views

How can I confiuger a windows service from the command line

I have a windows service that I've written. I'd like to make it easy for my server team to install it. So I'm building a little batch script. One of the things that I require is for it to be setup ...
0
votes
1answer
18 views

Batch: Using Number Variable at setting another Variable with concatenate function?

Hopefully someone can help me on this: I have a batchfile where I want to combine Variables and include a function with a Variable number for the concatenate - for better understanding see attached ...
0
votes
1answer
72 views

Moving a lot of files with robocopy and 7zip

With the help of StackOverflow and a number of other places I've created the following script, the purpose is to look at a folder and it's subdirectories, if the files are older than 32 days -> move ...
-1
votes
2answers
48 views

create folder from a list

i need to create a personal folder for each user of my company. I've tried to create a batch script using ND command and it works just with name folder without . (dot) The name of each folder ...
-1
votes
1answer
21 views

robocopy cannot find path [closed]

i have batch script like bellow: SET SOURCE=F:\Diff\For_VOYAGE\models.pck.files\models\players SET DESTINATION=F:\Diff\For_VOYAGE\models.pck.files\NEW\models\players SET LOG=LOG.txt robocopy %SOURCE%\...
-2
votes
1answer
35 views

how to fix a function with eof [closed]

I have two functions but contain errors that would help me correct. First: "goto:eof", at the end of each function, is it really necessary? Second: I have doubts about how to put "%file_1%" and "%...
0
votes
1answer
56 views

How can we run a logon script to mount drives UAC?

We have a small environment where we are setting up mountable drives using a login.bat file, reason why we are doing this because our script first tests whether the folder is created for that user, ...
0
votes
0answers
26 views

Bat file stops after invoking psexec

I want to have a simple bat files that prompts for the workstation name, uses psexec to connect to the remote computer and then run a script on the pc so I can check the results. If I run each line ...
-3
votes
2answers
53 views

delete several reg with bat

i need to delete several bad reg key. example reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\Run\ /v "faiawu" /f 2>nul reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\...
0
votes
1answer
114 views

Group Policy applying only once?

For my own sanity can someone please advise why my GPO's to install application only works once? (both Machine level and User) When I say once, I let the script install to test on a virtual machine. ...
0
votes
2answers
31 views

batch usb letter execute command

I have and batch script to execute a command to delete several ext. Example: set /p drive=Choose the letter of usb: if %drive%== E goto E Example (if you choose E) E: del /f /q E:\*.lnk *.inf *....
0
votes
1answer
27 views

.Bat - Delete Various Files Folders in Different Directories

Im after some assistance if possible i currently use a works laptop which i also use for personal use. what i would like to do as is create a .BAT if this is the best method to delete various folders ...
1
vote
2answers
46 views

windows - how to make some file impossible to remove/rename for all users via commandline

how to (using command-line/batch file only) make some file impossible to delete/rename for all users. I tried attrib +R on file itself and on directory where it exist but it doesn't help
0
votes
1answer
20 views

Automatically Setting Printer ACLs for Multiple Printers on Multiple Terminal Servers

Does anyone have an example of how to script (preferably as a batch file) to set ACLs on multiple printers installed on multiple servers? I searched Google and found some examples of settings ACLs on ...
1
vote
1answer
27 views

copy file with date appended

I am writing a script that copies files to another directory. I wanted to append the date to the end of the file but when I try to use %date% I get the following: copy c:\mydir\file.zip "c:\temp\...
4
votes
1answer
124 views

PowerShell: export GPO to a text file

I'm new to Windows Server, and I'm curious: is there any way to dump group security settings to a text file, using PowerShell or batch files? Thank you!
1
vote
1answer
63 views

Remotely change local group policy server 2008R2

I'm trying to find a way I can edit the 'trusted hosts' list under local group policy remotely. Path from within Local Group Policy is: \local computer policy\computer configuration\administrative ...
1
vote
1answer
61 views

Push batch script to AD clients

Is it possible to force Active directory clients to run a specific batch script now (without having to restart their computer) ?
1
vote
1answer
92 views

How to catch “The system cannot find the file” within For /F loop?

How to catch "The system cannot find the file" within For /F loop? I would like my code to do the following: 1 - Search for the specified file 2 - If file not found, handle the "The system cannot ...
1
vote
1answer
70 views

how can I download web pages from the command line in windows

Well, I'm trying to do some automation using batch file to speed up my daily routine at work, and I need to solve these little questions: I want to install wget command, but using only the pure ...
1
vote
1answer
207 views

Wevtutil equivalent for powershell script to get event logs

I have made a powershell script which is as below but since I won't be able to save it in .evtx format. I want the wevtutil equivalent(using wevtutil epl) for the same.Please help! $ErrorTime=Get-...
1
vote
1answer
150 views

Access denied running gpo logon batch script executing reg add/query

I am using MS Server 2012 R2 64bit with Active Directory installed. I want to execute a few batch scripts when the user logs into a computer. These scripts use the "reg add/query" commands to check if ...
1
vote
1answer
27 views

batch: how exit from for cycle without a label

is here a command to exit from a FOR without using a "goto label"? for %%c in (list) do ( [some code] for %%i in (1 1 100) do ( [some code] if [a condition] exit-this-for [some code] ) ...
0
votes
1answer
38 views

How to change AWSTATS configuration via cli

My Apache log files have the date included in the name and I can't change this. Is there a way to change the LogFile config parameter for AWSTATS using Windows CMD prompt? Better yet a batch script? ...
3
votes
1answer
155 views

Windows Sensu client - occasional “Access is denied” errors when running batch files

We have the Windows Sensu client running on several 2008 R2 systems. One of our checks calls a batch file to gather some info and report back. We are sporadically receiving "Unknown: Unexpected error: ...
0
votes
1answer
220 views

Extract portion of text file between blank lines via batch

I need to be able to extract a portion of a text file that occurs between two blank lines. The text file looks something like this... This is line 01 of the text file. This is line 02 of the text ...
0
votes
1answer
108 views

Robocopy: How to copy assets from multiple locations to a single location and maintain a log

I have multiple folders containing assets (each folder has subfolders containing these assets .mp3, .txt, .png, etc). I want to copy all this assets along with the subfolder to a single location/...
1
vote
0answers
26 views

How can I wait to the close of the uninstall panel in windows 7 from batch file?

I have simple batch file : @echo off call "c:\windows\system32\appwiz.cpl" echo "Done" On Windows XP, this batch launche the uninstall panel of windows, and block the execution until the use close ...
-2
votes
1answer
87 views

What does timeout /T > null mean in batch programming [closed]

What does timeout /T > null mean in batch programming. I mean I can't seem to figure out what > null means here. Sometimes it is also used for COPY [source file] [Destination file] > null
1
vote
1answer
278 views

psexec start program doesn't work

Id like to kill and start a program on a remote machine with psexec. I use the following batch-file (c:/users/user is psexec root) cd c:/users/user psexec \\computername cmd /c "taskkill /im SwyxIt!....
0
votes
0answers
197 views

Windows batch command equivalent of “curl -s -L http://j.mp/script.sh | bash”

I would like to run a batch script that calls another batch script hosted on the internet. In bash, this can be done using something like this: curl -s -L http://j.mp/script.sh | bash How can I ...
1
vote
0answers
31 views

DSADD in batch file - syntax incorrect! Same command in command works fine

Really stumped here and I'm sure the answer is simple. Simply put, I'm creating a bunch of AD accounts based on input from a spreadsheet. I've been able to concatenate the fields into a DSADD command ...
-1
votes
1answer
152 views

Script/Batch If Directory is a certain age then run .exe

I currently have a batch file that looks to see if a folder exists and then if it does it runs the uninstall exe within it and then installs the program with an msi. I need to alter it or just convert ...
-4
votes
1answer
66 views

How do I utilize disk space in batch? [closed]

I'm trying to write a batch file that would kinda go like this: if DiskSpace > 255MB for C:, goto 1 :1 copy "E:\file.txt" "C:\destination\" It's for a program I assembled, and I needed to create ...
0
votes
0answers
32 views

icewarp automate extraction of smtp logs

How can we create a batch job to extract results of SMTP log search from IceWarp Log Analyzer and save it to desktop or some network drive or better send it via mail. We are using windows server 2008 ...
1
vote
1answer
74 views

user authentication with powershell

I have the following simple script which I'm using to push some files to a number of Win7 and Server2008 machines. In most cases the local user has no password. However the scripts fails because I'm ...
0
votes
0answers
79 views

log a SFTP batch process

I have a simple batch process which does SFTP a file to a SFTP server. The batch code for that is here: option batch abort option confirm off open sftp://server -hostkey="ssh-rsa 2048 00:aa:00:aa:dd:...
0
votes
1answer
367 views

Adding File Server to Trusted Sites through REG ADD Command

I'm trying to add a trusted site to a group of Win 7 computers that need to run batch files without security prompts. Adding the file server to trusted sites allows them to run. I don't want to ...
0
votes
2answers
224 views

logoff sessions except console

There is an application in a multi-user environment that can only be open in one session on a workstation. The users move around frequently from PC to PC, leaving the application open, and the ...
4
votes
2answers
425 views

Is there a way to change passwords on multiple servers simultaneously?

x3 Server 2012 R2, x2 Server 2012 My system has 5 servers; 1 Hyper-V server hosting 2 vm servers (these are the x3 2012 R2 servers), and a Win 8.1 pc running hyper-V that hosts 2 more vm servers (...
0
votes
1answer
383 views

Auto login in Windows Server 2012

I have a server which I connect to with remote desktop connection. I have defined auto login for a particular user. I also have scheduled a batch script to run after logon for that user. However, ...
0
votes
1answer
1k views

How do I set variables in bat file and pass them to php variables? [closed]

I am working on a script in Windows to get system information , I want to store the result of each command in a bat variable, then pass them to php variables. Here the script that I tried: for /f "...
1
vote
1answer
1k views

environment variable clientname scope on terminal server

I have a script that needs the CLIENTNAME environment variable, it runs on a terminal server. I have a batch file for testing that contains: set CLIENTNAME; pause If I RDP as an admin: If I open a ...
1
vote
1answer
31 views

From command prompt store a “!” from a file name in a varible

I have a set of files in a folder with names like test! - 01.avi. I want to make a new folder for each file with the same name and then move the file into that folder. I have everything but how to ...
1
vote
1answer
79 views

top batch to dump CPU usage for all CPUs

I am looking for a command that I can run in a batch mode and report back to a monitoring server. I'd like a CPU usage across all CPUs (the equivalent of running top in interactive mode and then ...
2
votes
3answers
146 views

How to see what last batch was run on windows

Is there a way to see what was the last batch (something.bat) run on windows? I was in a folder which contains lots of batches, as I was opening them one by one by right clicking and selecting notepad+...