Questions tagged [batch]

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.

This was the first extension used by Microsoft for batch files. This extension runs with MS-DOS and all versions of Windows, under COMMAND.COM or cmd.exe, which execute its commands, normally line-by-line.

339 questions
1
vote
1 answer

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) ?
joebegborg07
  • 869
  • 5
  • 16
  • 24
1
vote
1 answer

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 find the file" by sleeping for 10 seconds and…
1
vote
1 answer

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-WinEvent -FilterHashtable @{ Logname =…
1
vote
1 answer

'net use' error after 'rasdial' in batch file

I'm writing a batch script that does the following: rasdial - connect VPN net use - map a drive to a remote folder share (on the VPN) xcopy - copy a bunch of files from the mapped drive to the local machine net use - unmap drive rasdial -…
Greg Dean
  • 113
  • 4
1
vote
1 answer

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 a registry key exists and if it doesn't it will…
Carl Rod
  • 13
  • 1
  • 1
  • 4
1
vote
1 answer

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] ) rem go here when exit [some code] ) i hate the…
CSG
  • 727
  • 1
  • 12
  • 19
1
vote
0 answers

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 the panel. The same batch on Windows 7 doesn't…
iXô
  • 111
  • 5
1
vote
1 answer

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!.exe /f" psexec \\computername cmd /c "taskkill /im…
SimonS
  • 785
  • 4
  • 14
  • 29
1
vote
1 answer

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 trying to write through the admin share (c$). What…
dcrearer
  • 133
  • 6
1
vote
2 answers

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 workstation locked. Disabling user switching is…
user229603
  • 11
  • 3
1
vote
1 answer

Batch sending s/mime encrypted email - How?

I need to send some sensitive data periodically to a set of recipients via email. Due to the nature of the data, we need to send it encrypted. Some of our clients use PGP/GPG, so it's not an issue, but we have a few cases where the client is not…
JJarava
  • 167
  • 2
  • 9
1
vote
1 answer

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, when I restart the server and later try to logon…
Ole-M
  • 113
  • 3
1
vote
1 answer

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 command prompt, run the script, it shows the…
1
vote
1 answer

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 pull in the "!" and copy the file to the…
Pyrotek
  • 13
  • 2
1
vote
1 answer

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 hitting the '1' key). It should work on Mac, Ubuntu…
user1130176
  • 173
  • 1
  • 10