11
votes
8answers
721 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 ...
1
vote
1answer
89 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
118 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
49 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, ...
0
votes
0answers
87 views

Output results of findstr at a Batch file so they can be read by PHP

I have this Batch file which looks for a string through a the files in the current folder: @echo off for /f %%i in ("*") do ( findstr /m /C:color "%%i" ) Now I would like to output the ...
0
votes
1answer
98 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 ...
1
vote
1answer
91 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 ...
0
votes
1answer
211 views

windows xp batch - check if printer exists

I am looking for a batch-function to check if a printer does already exist on a windows xp system. I made up the following script: set PRINTEREXISTS=0 For /F "Tokens=8 delims=\" %%I IN ('reg query ...
0
votes
0answers
31 views

windows xp - batch remove IPP printer

How can I remove a printer using IPP (example URI: http://10.0.0.1:631/printers/r123-printer01) from windows batch? There should probably be a way using rundll32 printui.dll,PrintUIEntry, but I ...
1
vote
2answers
79 views

computer startup script reporting success to a server

I am using Group Policy to deploy a computer startup script that tries to uninstall one program and install another. I need this script to report its status (whether a certain file exists on the ...
0
votes
2answers
97 views

Why doesn't rsync over ssh work when placed inside a FOR loop in a batch file?

I've placed the ff. code in rsync.bat: for %%A in (%VAR_REMOTE_HOST%) do ( set VAR_TARGET=%USER%@%%A:%VAR_TARGET_DIR% echo Rsync Source Dir: %VAR_SOURCE% setlocal ENABLEDELAYEDEXPANSION echo ...
0
votes
0answers
69 views

Batch script terminates too soon

I need some help with Windows batch/CMD scripting. I wrote a script to record mic-in to a MP3 for 12 hours. It runs ok when running it manually. It will run with task scheduler too - just that, ...
0
votes
3answers
435 views

Stop and start batch file every hour

I have a batch script which starts a program that runs in cmd.exe I have tried using task scheduler to create a task which stops this cmd shell and starts a fresh one every hour to no avail. Are there ...
0
votes
1answer
270 views

How to reference Domain-Admins with icacls?

I need to reference the "Domain-Admins" group in a batch file. The line in question looks like this: icacls "test\folder" /grant mydomain.com\Domain-Admins:F ... and works as expected. But how do ...
0
votes
1answer
112 views

Windows batch find folder if statement

Assume a file system with the following format Folder A --->Folder 1 --->Folder 2 --->Folder 3 etc.. Folder B --->Folder 4 --->Folder 2 --->Folder 3 Folder C --->Folder 1 --->Folder 2 --->Folder 3 ...
2
votes
1answer
605 views

Batch - how to copy file by minimum size and date modification?

I have this simple batch script which copies the newest file in some dir to another place. I want this script to also ignore all files (in the DIR command section) under 1GB of size. FOR /F ...
2
votes
1answer
135 views

Powershell script on the hidden file share not accesible on the workstation

We have a PowerShell script script.ps1 on a hidden shared folder \\Server\Share$. We have a bat file Initiator.bat, which executes the script. The shortcut to the batch file is placed on the user's ...
1
vote
1answer
486 views

Start /WAIT RDP FIle in Windows 8

I am not sure if I should post this one here or in StackOverflow. I want a BAT that opens a RDP connection file and then, when the connection is closed, logoff the machine. start /WAIT ...
1
vote
2answers
741 views

RoboCopy A File From The Web?

Is it possible to download a file from the web using RoboCopy? What would the syntax for that be? Here's what I'm trying: RoboCopy "http://www.google.com/" "C:\some_folder\" "index.html" /L /V /E ...
0
votes
1answer
361 views

“Access is denied”, only when trying to run script over telnet

I have a batch script that restarts a Windows Service with: Net stop <servicename> Net start <servicename> I got around having to manually run it as Admin by creating a shortcut to it ...
0
votes
1answer
1k views

Running a batch file from PHP - interactive services detection? [closed]

I am having a very hard time getting an executable to run from within a PHP script (using exec(), or a number of other PHP commands I've tried). The issue seems to be coming down to a question of ...
1
vote
0answers
93 views

Windows file compare (FC) spurious differences

I'm getting differences like this: a.txt Betty Davis Cathy Edwards b.txt Betty Davis Cathy Edwards There are only two lines listed in the diff (which doesn't ...
0
votes
1answer
415 views

Automatically restore windows network drive (red “X”) via batch file

i need check if a network drive is mapped and accessible. From time to time windows displays a red X on the drive, and i would need to manually click the drive in explorer to reconnect. I already ...
1
vote
3answers
1k views

How can I hide ms-dos window when running a .bat file?

I am running a .bat file for my script (Scheduled Tak (CronJob)) per minute. When it run, seems ms-dos window short period of time. My batch code like this; @ECHO OFF C:\wamp\bin\php\php5.4.3\php.exe ...
1
vote
1answer
702 views

Migrating ODBC information through a batch file

I am a desktop support technician currently working on a large scale migration project across multiple sites. I am looking at a way to transfer ODBC entries from Windows XP to Windows 7. If anyone ...
1
vote
2answers
958 views

How to “ignore” username and password prompt in net use

I have at the moment a logon.cmd script, that I'm using to map network drives to the users profile. It looks like this: ::Onboarding net use m: /delete net use m: \\BOB\onboarding ::Bookings net use ...
2
votes
2answers
6k views

How to create a never expiring password & user via net user through .bat file

I am using a .bat file to create a user and password at windows operating system level. The issue am facing is when i pass EXPIRES:NEVER for password, when the user is created, it doesn't have ...
1
vote
1answer
160 views

How to dump certificate file from installer via command-line?

I'm building a script that will download and install a bunch of programs. One of those programs depends on a virtual driver, which needs its certificate to be imported in order to function. Normally, ...
26
votes
2answers
45k views

How to sleep in a batch file?

How to pause execution for a while in a Windows batch file between a command and the next one?
1
vote
2answers
649 views

Batch file to uninstall windows update?

Is it possible to make a batch file to uninstall a specific windows update (eg. KBxxxxxx)? We use 20 year old web based software to enter hours where I work and a new update is causing the program to ...
2
votes
4answers
422 views

What is the efficient way to backup large files?

I have the schedule job of backing large files in Windows Server and it takes almost 2 hours to finish. For now, I only use copy command in the .bat and copy the large files to another folder. I'm ...
2
votes
3answers
658 views

Using a for loop in Microsoft cmd.exe, how can I process only the files with a certain extension?

I have a the folder c:\test\ and two files in it a.txt and b.txtv. I would like to process just the files with extension equal to .txt. If I write this commands cd c:\test for %f in (*.txt) do echo ...
-1
votes
1answer
1k views

How to do a Batch file that get all files in a directory and zip it?

i would like to know how to get all single .bak (or anyother extension) files into a directory, and zipping them (one by one) and save them using the same name, changing only extension. Thanks
1
vote
1answer
210 views

Task scheduler not running (Server)

I have written a simple bat file to copy .txt files from one drive into another one. I want this to run everyday at this time but the problem is when I'm not logged in to the server the task does not ...
2
votes
1answer
145 views

How do I run bat file inside cmd using tash scheduler

How do I run bat file inside cmd using tash scheduler. I've tried this one C:\windows\system32\cmd.exe C:\synchronization.bat And doesn't working.
2
votes
2answers
151 views

Change windows group permissions without the sufficient rights in a batch

I wrote a batch file, which creates multiple folders und subfolders in the current directory. The group permission of one folder is also changed. This works on my local workstation with administrator ...
1
vote
2answers
827 views

delete all folders with tmp in name using batch file

Have tried to google this, but I always seem to get results relating to .tmp files, which isnt really any use. I have only a basic understanding of batch files, but I think I need something like ...
1
vote
1answer
850 views

batch file infinite loop when parsing file

EDIT: Apparently I don't have enough rep to answer my own question, so the answer is going here. OKAY! SO! I didn't exactly solve the problem... but I stopped using cacls.exe and started using ...
1
vote
1answer
220 views

Cacls, full permission, local names

I tried to use cacls to give "Everyone" group access to certain folder. And I failed. As I understand the reason is i'm trying to use groupname in english while my windows is localized. Attempt to use ...
0
votes
4answers
607 views

Windows XP batch file to block all incoming and outgoing traffic

Is it possible to block all incoming and outgoing traffic on a Windows XP host via batch file? Bonus question, I only want to allow 1 outgoing port and all traffic going over that port.
2
votes
3answers
375 views

I need to clear out the same directory on multiple servers across a network. How do I do this?

On multiple (about 20) servers, there exists the same directory C:\Deployments. This directory has multiple subfolders which contain more subfolders and files. The C:\Deployments directory itself ...
1
vote
1answer
365 views

Change Registry Value Command Line

Is there a way to set a registry value with a command line without using a .reg file to import it? I've looked over the reg and regedit.exe command line options, and it doesn't look like there's a ...
1
vote
1answer
101 views

Why can't I get the `for` command work in my command line [closed]

This could also be read "Why can't I get the for command work in my batch file." When I try using the command: FOR /F "tokens=1-4 delims=/ " %%a in ('something cool') DO something else cool %%a %%b ...
2
votes
3answers
2k views

keep command window open after running bat file

i have a bat file that has the following it: sm start "Schedule" this code runs but the command window closes immediately what can i put inside the bat file to keep the window open?
0
votes
2answers
2k views

How can I find multiple values from windows command line output?

Example, to see if KB983590 is installed: systeminfo | find "KB983590" But what if I wanted to find out if more then one KB was installed?
17
votes
4answers
57k views

Get directory containing the currently executed batch script

I use %0 in batch file to get the containing directory of the batch file but the result is :- c:\folder1\folder2\batch.bat I want just directory, without batch file name, like this :- ...
0
votes
1answer
147 views

How to create a windows user from the command line, using a password from a file

Im in a somewhat unique situation. I am trying to create a windows user, using the command line or a batch file. I know how to do that in the basic case: net user username password /add The ...
0
votes
1answer
197 views

Install cmd script to set user environment variables from file

Each line in input file.txt has two values separated by a space. Currently using: for /F "tokens=1,2" %%i in (file.txt) do call :setvars %%i %%j :setvars set %1=%2 set %3=%4 set ...
1
vote
0answers
71 views

Why is my IF comparison op failing?

update SOLVED - the problem is not with my code. there is a design limitation (some might say "bug") in the command processor. the IF comparison operators do not work with values higher than ...
0
votes
3answers
1k views

Autostart Cygwin on Windows boot and run a cygwin command

Sometimes my Windows server reboots at night to install new updates. Then the next day I find out that my cygwin instance has been stopped. What I want is on Windows start, also run Cygwin AND run a ...