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)

1
vote
0answers
3 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
0answers
11 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
24 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
43 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 ...
2
votes
1answer
61 views

Why does scripting with appcmd behave differently than using IIS GUI?

I've scratched my head raw on this. Please help me stop the scratching. We have a manual workaround for a site problem we're experiencing. The workaround always works when we do the steps ...
1
vote
1answer
54 views

icacls variables in batch file

I'm moving users to a new domain, file server and user name format. I'm trying to write a simple DOS batch to copy the data and set the permissions. X: is mapped to the old server and E: is the local ...
1
vote
1answer
27 views

Backup databases from MS SQL Server 2008 Express database thru batch script

I need batch script to backup selected databases from Microsoft SQL 2008 Express Edition. Unfortunately MS SQL Server 2008 Express edition lacks of visual database backup tools called Maintenance in ...
2
votes
1answer
50 views

Managing power options

For various reasons, we want our clients' computers to not sleep when on AC. We have been running the following script with moderate success: powercfg /change standby-timeout-ac 0 However, the ...
-1
votes
1answer
42 views

Delete files by date and character count

I have an interesting problem. I need to delete directories that are older than x days but are only numerical. We have a log folder that has log files that we need to delete but other files and ...
0
votes
1answer
61 views

Batch script to increment the text file ans also the value inside the file [closed]

I have a text file Foo.txt which contains value content0. I have to create a batch file which increment the text file like Foo1.txt, Foo2.txt.....Foo5.txt and also the values in the file content1, ...
0
votes
2answers
58 views

Bat script start a program and than restart

I need some help creating a .bat script that starts a program and when done it restarts the computer. cmd /c C:\"Program Files"\"Toolwiz Time Freeze"\ToolwizTimeFreeze.exe /usepass=password ...
1
vote
1answer
30 views

How to get value of environment variable from passed command line parameter

I have to use/reference an environment variable value which will be passed as a command line argument. Something like below set myvar=%1 echo Value of %myvar% is %%myvar%% Here in %%myvar%% I want ...
1
vote
1answer
42 views

Add new dependency to a Windows Service that already has dependencies

I want to add via Batch script a new service-dependency to an existing service with old dependencies, without deleting these dependencies. I know the command sc config ServiceA depend= ...
-4
votes
2answers
42 views

Need assistance Creating special Batch file [closed]

I need help to create a batch file that will delete log files in D:/folderx on Server:\serverx This is to eliminate the manual process of cleaning up the disk to avoid a page out of low disk space. ...
1
vote
2answers
97 views

Loop in a Windows batch file

I have a problem where I need to clone one virtual machine into several machines for production. The machines have names that is assigned by variables and a rdp port is also assigned by a variable. ...
0
votes
1answer
56 views

Testing MySQL 32-bit ODBC connection via CMD

I'm going to make a batch script to do some basic troubleshooting. Among other things, I want to test 32-bit MySQL ODBC's for connectivity. This script will run locally on each workstation. There ...
2
votes
1answer
108 views

Can I permanently add to PATH in windows using batch?

Is it possible to permanently add c:/project/bin to PATH i windows using only batch?
1
vote
1answer
58 views

Rename NTFS file to eliminate multiple periods via batch

I at wits end trying to rename NTFS files that have technically legal, but problematic multiple periods in my Windows 2012 Server share Files are dropped in a share that look like this: ...
6
votes
2answers
515 views

Determine if C drive has 2 GB of free disk space

I am trying to determine if a target pc has atleast 2 GB of free space. Here is what I have so far: @echo off for /f "usebackq delims== tokens=2" %%x in (`wmic logicaldisk where "DeviceID='C:'" get ...
2
votes
1answer
932 views

Can't run .bat file off share, but can from cmd

I have a smb share on a Linux box set up that I can view in explorer: \\XXX.YYY.ZZZ.QQQ\Share In this share is a batch file: \\XXX.YYY.ZZZ.QQQ\Share\Scripts\Script.bat I can open the file in ...
0
votes
1answer
42 views

Shut down syspro 7 processes

We have nightly backups run on our Windows Server 2012 R2 sys pro 7 server. Having the syspro processes running during backups can cause file lock issues and other errors. Does anyone know a way we ...
1
vote
0answers
127 views

Powershell-Script is not exectued correctly

I have a power-shell-script which is called by a batch-file. The batch calls the script after it has set the execution policy to unrestricted. Currently the script does nothing more than writing a ...
1
vote
2answers
419 views

Disable NIC advanced properties in Windows server 2008/2012

I have some Rackspace VM's and need to disable these advanced NIC properties: Correct TCP/UDP checksum value IPv4 checksum offload Large receive offload Large send offload version 2 TCP checksum ...
2
votes
1answer
217 views

How to remove directories using wildcards by reading a file using batch?

Batch file for /f "delims=" %%f in (7profiledeletelist.txt) do rd /s /q "%%f" PAUSE exit 7profiledeletelist.txt C:\Users\1* C:\Users\2* C:\Users\3* C:\Users\4* C:\Users\5* C:\Users\6* C:\Users\7* ...
2
votes
3answers
2k views

Batch script to export info from Active Directory (name, phone numbers, location, etc) into a csv file

The secretary at my work uses a spreadsheet that lists names, phone numbers, and locations of employees to look up info if someone asks. All this info is located in AD, but the problem is that we are ...
9
votes
5answers
8k views

Program does not run properly as Scheduled Task

Situation I have a batch script that prepares some files, executes a program (.exe) and then deletes said files. This task should run hourly, so I'm trying to configure this using Scheduled Tasks. ...
0
votes
1answer
144 views

get files from a shared folder with password from a anohter computer with batch file

I'm using a .bat file to get some files from a shared folder on another computer in the same network. My challenge is that the shared folder is password protected. Is there a way to write username and ...
0
votes
1answer
147 views

Windows - How to redirect all console output to text file? The console program is called by another software that I can't control

It is a pretty complicated issue (at least for me). GUI software at a given moment, calls console software, which outputs something to console and quits. I'd like to save those results to a text ...
-1
votes
1answer
430 views

Best Practices for User folder permissions [closed]

The following is my bat file. Is there a way I can substitute First.Last with usernames from a CSV file? My boss doesn't want to do all the users at once. He's afraid that something may happen so he's ...
0
votes
1answer
56 views

I am unable to set the owner of a folder back to the user from my bat file

The following bat file is being used to fix permissions for Users in our organization. Everything works perfectly until we try to set the owner back to the user. takeown /F F:\Users\First.Last /R ...
0
votes
0answers
13 views

One location to other location through the move specified files names only

I have so many files move to one location to other location through the move specified files names only . a .txt with a list of name files: 101.jpg 222.jpg 205.jpg etc. ... I need a script that ...
3
votes
5answers
325 views

del *.txt removes also file.txt_backup

Imagine that we have directory c:\test with following files: first.txt second.doc third.txt fourth.txt_bak I want to remove only txt files, but leave doc and txtwhatever untouched. When I run ...
2
votes
2answers
828 views

Batch rename directories with regex via command line on Linux

I have a folder on the server that contains directories that are created daily and are named by date, like so: 07-06-14 08-06-14 09-06-14 etc. At some point I decided that a preferred naming would ...
1
vote
1answer
134 views

if exist !SOMEPATH! not working in batch file

I have a batch script in which i am using multiple if exist statement, the problem is all statements are working except one . Following variables are set SETLOCAL ENABLEDELAYEDEXPANSION SET ...
2
votes
2answers
499 views

simple script to backup PostgreSQL database

Hello I write simple batch script to backup postgeSQL databases, but I find one strange problem whether the pg_dump command can specify a password? There is batch script: REM script to backup ...
11
votes
8answers
2k views

Expire Files In A Folder: Delete Files After x Days

I'm looking to make a "Drop Folder" in a windows shared drive that is accessible to everyone. I'd like files to be deleted automagically if they sit in the folder for more than X days. However, it ...
0
votes
0answers
454 views

Error: “Parameter is incorrect” when opening 0b bat/cmd

Having sort of issue that is more likely annoying when need to create short batch script (though it's not scripting issue). I want to right-click on desktop and create new text file. Rename it and ...
1
vote
1answer
337 views

Running multiple instances of a Batch file in windows simultaneously?

I have a windows batch file that is invoked by windows scheduler. When I try to have multiple windows scheduler tasks trying to run the batch file simultaneously, the batch file is locked by the first ...
0
votes
1answer
1k views

How to script vpncmd to batch command connect/disconnect?

Here is my connect.bat -----BEGIN------ vpncmd localhost /client accountconnect myConnectionName -----END------ After executing connect.bat, here is the screen result: Connected to VPN Client ...
0
votes
1answer
335 views

How to use a freshly installed environment variable in Windows

When I set an environment variable through the setx command in Windows 7, the variable is correctly set but if I type in set, it list the environment variables that were set at the script start up, ...
3
votes
2answers
171 views

Make windows all in capitals for specific application

Is there a method where I can set windows transparently to caps preferrably when a specific application is run. For bonus points, I should be able to revert back to normal (non capslock mode) when ...
0
votes
2answers
1k views

Change Chrome homepage for multiple PC's

In our business we have about 300 PC's. What I want to achieve is to change the homepage on all browsers (IE, Chrome and Firefox). The problem is that I can't find any way to set/change the homepage ...
-1
votes
1answer
240 views

Space in batch commands (del and taskkill) [closed]

I have a problem using del and taskkill. del D:\New Folder.exe I tried changing the code to this: del D:\"New Folder.exe" That didn't work So I tried this: del "D:\New Folder.exe" Still not ...
3
votes
1answer
1k views

wevtutil requires Run As Admin for Security log (but not for System), or how to Run As Admin for Task

I'm using this query to check for certain Exchange account changes on my Windows 2008 R2 AD primary: wevtutil qe Security /q:"*[System/EventID=5136]" /f:text /rd:true /c:1 I'm making a batch file ...
2
votes
1answer
196 views

batch - File last modification time with seconds

I want to know when a file has been modified for the last time. I can get these infos using the following batch script: FOR %%i IN (myfile) DO SET modif_time=%%~ti The problem is that I need ...
1
vote
0answers
237 views

Trying to run a netsh batch with foreign characters

I am trying to run a batch file with the following content: netsh interface ip>set dns "Połączenie lokalne" source=dhcp The file is saved as ANSI. My Windows codepage is 1250, the OEM one 852. ...
0
votes
1answer
972 views

Exporting Security Group Memberships in Batch

I have the following command but it doesn't work when put into a batch file: dsquery group DC=domain,DC=com -name "Group Name" | dsget group -members | dsget user -display >> "Group Name.txt" ...
0
votes
4answers
5k views

Robocopy fails in Scheduled task with ERROR 1326 Logon failure

My aim: To simply mirror a database backup directory onto another server Approach: Use Robocopy statement contained in a scheduled task robocopy "C:\MylocalDirBackup" "\\MY.IP\DatabaseBackupsShare" ...
0
votes
1answer
268 views

Batch script - How to release a locked file for batch 'copy'

A daily windows scheduled task triggers a batch script which moves program files to a folder on a server, using a simple copy routine. rem deploy programfiles copy dailybuild\*.dll ...
2
votes
1answer
142 views

Weird issue with .bat script

I have a .bat script which instals 3 pieces of software. When i open an elevated Command promt , browse to the file and run it everything works fine. When i run the .cmd directly ( using the 'run as ...