Questions tagged [script]

An automated series of instructions carried out in a specific order, such as a Windows script created to launch a specific program on startup.

Filter by
Sorted by
Tagged with
13 votes
3 answers
72k views

Synchronize Internet Time in a Windows script?

Is there a way I can synchronize the system clock with an Internet Time server (i.e: time.nist.gov) via command-line? Preferably, this should be something executable via BAT or PowerShell script. ...
Iszi's user avatar
  • 13.8k
12 votes
6 answers
18k views

How to find newest files in a directory, including subdirectories?

I'm looking for a way in Windows to list all files in a given directory and its subdirectories, sorted so that the newest files are on top. Is there any easy way to do this? I'd also settle for a Perl ...
Kip's user avatar
  • 4,594
11 votes
3 answers
34k views

How do I automate an MSI installs?

I have about 20 applications that need to be run in a specific order. I want to script them so that I can do this remotely. Each one of the applications has a Setup.exe and an MSI. I was hoping just ...
Mowens's user avatar
  • 111
10 votes
2 answers
24k views

Windows 8 Run script on startup

Recently installed the Win8 RTM on my MacBook air and made a short AutoHotkey script to reverse the scrolling to be like MacOSX Lion. My question is... how do you run a script at startup on Windows 8,...
Aidan's user avatar
  • 103
10 votes
1 answer
20k views

Run a batch command for every file in a directory

I have a Java program working with this syntax: command.jar namefile I have to run this program for 1600 files in a directory. How can I run this command for every file automatically? Is there a ...
user avatar
10 votes
1 answer
46k views

Running msiexec with PowerShell

I'm try to run msiexec in PowerShell but I keep getting an error message. If I run it from cmd then it's all fine. Can someone please let me know how I can run this command in PowerShell? This is ...
user630320's user avatar
10 votes
4 answers
39k views

How do I make a script run upon startup of the Ubuntu machine?

I want to run /home/myuser/go.py How do I make that run in the background, everytime my linux machine boots up?
Alex's user avatar
  • 2,481
9 votes
4 answers
13k views

UNIX shell scripting: how to recursively move files up one directory?

I have a large number of small files, f, arranged in a directory structure like so: /A/B/C/f There are 11 directories at the level of A, each with about 100 directories at the level of B, each with ...
jl6's user avatar
  • 1,175
9 votes
2 answers
49k views

How to create multiple folders and name them by reading lines from text file?

I have a plain text file named Export.txt. It contains a list of geographical places, preceeded by a 3 digit number with leading zeros. Example --START OF FILE-- 001 Aberdeen 002 Bellevue 003 Camas ...
Samir's user avatar
  • 20.8k
9 votes
3 answers
11k views

OSX 'open with' bash script

I've got a bash script, potentially many of them in fact, which I'd like to be able to open files in OSX's finder with. It's a really, really simple concept but for some reason bash scripts are ...
rich's user avatar
  • 1,231
9 votes
4 answers
8k views

Hook into linux mount/umount event

is there a way to provide post-mount and pre-umount scripts in Linux? I am trying to do some scripts on storage media when mounted and before umounting (eg, for synching). Any help appreciated.
Jörg Haubrichs's user avatar
8 votes
2 answers
13k views

Powershell Get-ChildItem Include\Exclude - simple script not working properly

Im trying to run the following code as a powershell script,but I cant get it to work. 1st,the following works with one -Include item but I cant seem to get it to work with multiple ones. 2nd, the -...
securityghost's user avatar
8 votes
1 answer
10k views

Using NppExec and Ruby to script a new macro feature for Notepad++

I work in U.S. and Europe, and switching between month/day (US) and day/month (EU) formats leads to ambiguities when looking through logs or notes (e.g. is 7/8/12 July 8th or 7th August?). I'd like ...
Assad Ebrahim's user avatar
7 votes
1 answer
5k views

Script to verify a signature with GPG

You can feed GPG a file that has been signed and it will spit out a "signature is good" message, and save the plaintext: [gh403@shillig-arch ~]$ gpg test.gpg gpg: Signature made Thu Nov 1 14:19:08 ...
thirtythreeforty's user avatar
7 votes
3 answers
8k views

I want to execute the commands in a loop at the same time, not one after another

I'd like to write a loop ('for') that will do some action 'X' number of times. But instead of performing the actions sequentially, one after another, I'd like them to execute simultaneously (in ...
Felipe Alvarez's user avatar
7 votes
2 answers
24k views

Starting a script on xfce login and logout?

I use xfce4 as my desktop environment, running on a Gentoo box. I want to start the pulseaudio server when I login. In general, how do I get a script to run as soon as I login to xfce, and how do I ...
Bkkbrad's user avatar
  • 493
7 votes
3 answers
5k views

How to set the value of an environment variable to the output of a command in a WIndows batch file?

How can I set an environment variable to the output of a command in a Windows batch file? The command will return a single value of around 32 characters (e.g. type myfile.txt).
slantalpha's user avatar
5 votes
3 answers
20k views

Powershell one-liner to show process on same line as port using netstat issue

First I just want to make sure user Erik Bitemo gets credit for the original code I'm using here. The output is what I'm looking for with one exception: One of the ports disappears and "System System5"...
ex28's user avatar
  • 81
5 votes
1 answer
18k views

Append to start of filename

I'm trying to add the word [Replay] to all mp3 files in a folder using a batch file like so: @echo off for %a in (c:\folder\*.mp3) do ren %a [Replay]%a But it wont rename the files. all the ...
TonalDev's user avatar
  • 173
5 votes
3 answers
23k views

How do I run a batch script at shutdown in Windows 10 home edition?

I need to run batch scripts at shutdown of Windows 10 home edition, both on manual restarts and on automatic restarts due to Windows automatic updates. This needs to work while no users are logged in ...
B. Gray's user avatar
  • 51
5 votes
3 answers
13k views

How can I manually load/unload a driver in Windows Vista?

I think one of my drivers is causing some of my Windows Vista machines to boot extremely slow. Since the perf log is basically no help, I want to try manually unloading/loading drivers to see if ...
Dane O'Connor's user avatar
5 votes
4 answers
12k views

Delete blank lines from a text file

I am trying to delete all the blank lines in a text file. Is there a quick way to do this? What I have line one line two What I want line one line two I am using Notepad++, so a solution using ...
Kapsh's user avatar
  • 417
5 votes
1 answer
4k views

Checking VBScript for syntax errors without actually running the script

I have a script in VBScript. I'm not sure if it contains any syntax errors or other non-runtime errors. Normally I would just run the script, but I don't want the script to actually run because the ...
Vivelin's user avatar
  • 1,256
4 votes
1 answer
7k views

Setting file creation date in Mac OS X

I need a script to set the creation date to the modification date for a bunch of files created by my sound recorder - any way to do this? Running Mac OS X 10.4.11
user avatar
4 votes
2 answers
3k views

Looking for a way execute a task on all files in a directory (recursively) on Windows

I have a huge number of mp4 video files that needs to have a volume boost. I need a way to execute a ffmpeg audio filter on all files in a specified base directory (and in subdirectories as well). My ...
stzzz1's user avatar
  • 45
4 votes
1 answer
5k views

Automate BTWiFi login using a FON account

I'm a user of British Telecom's Wifi hotspot. The service is good, but after some time of inactivity it logs me off and asks for user name and password. It's really annoying in the long run. Did ...
sscarduzio's user avatar
4 votes
1 answer
9k views

Batch script to delete specific folders

I want to be able to run a script at a parent folder that contains other folders, the script will delete all the folders of a certain name. So for example to remove all the bin folders and only them: ...
shinzou's user avatar
  • 504
4 votes
2 answers
9k views

Run A Script When Connected To A Wireless Network In Linux

Is it possible to have a script run when I connect to a wireless network? My university hijacks all HTTP(S) connections when you first connect to force you to log in with your university account. I'...
Ryan Fox's user avatar
  • 396
4 votes
3 answers
11k views

One-gesture solution to disable/enable a device in device manager (without a third-party tool)?

To overcome an annoying bug in Windows 10, I found a solution. The problem is, it's a lot of clicking and I'd like to automate the steps (script?) if possible. Here's the context from Reddit: There ...
Fuhrmanator's user avatar
  • 2,869
4 votes
2 answers
2k views

Automator app won't open after being copied to another computer - OSX

I created an app in Automator. The app runs fine on the computer with which I created it, but when I copy it to another computer I get: The application “AppX” can’t be opened. If I open it in ...
SFBA26's user avatar
  • 141
4 votes
7 answers
5k views

UNIX find dirs that contain a particular file (pom.xml) then execute command in that dir

I want to, from a root dir, find all dirs that contain a certain file name (pom.xml), then cd to that dir and execute a command. I can do this in a script but I was hoping to do this with a single ...
user avatar
4 votes
1 answer
2k views

grep fails in upstart script

I have an upstart configuration for a service which needs to check the existance of a process on it's startup. This sounds fairly easy but I'm already trying for 3 hours to get this thing solved and I'...
Thorsten Schöning's user avatar
4 votes
1 answer
1k views

how to copy I/O not just redirect (Windows and Linux)

I have a simple call command call calabash -D sim.xpl >test.txt 2>&1 and this redirects into test.txt, how do I do both redirect into a file and allow it to show up in the prompt? (I ...
jtzero's user avatar
  • 175
4 votes
1 answer
1k views

How to get user defined language in Notepad++ to follow master formatting?

I have successfully created a user defined language file in Notepad++ and this file has formatting, highlighting, etc. What I am hoping to do however is tie these into the main theme is. But it looks ...
enderland's user avatar
  • 1,988
4 votes
3 answers
2k views

Can I use a bash script as a Service in OS X without having to set it up trough automator?

How can I use a bash script as a Service in OS X without having to set it up trough automator? I'd basically like to write a bash script, save it in ~/Library/Services and then just have it show up ...
cwd's user avatar
  • 18.1k
3 votes
1 answer
34k views

Change NIC speed/duplex settings in script?

I have a laptop running Windows Server 2003 SP2, with PowerShell installed. Occasionally, this system has to be used in environments where it needs the NIC manually set to 100 Mbps/Full Duplex in ...
Iszi's user avatar
  • 13.8k
3 votes
1 answer
339 views

Force a bash script to run to completion where some items may stick

I've a Uni assignment I'm building that I need to run multiple times with multiple different parameters to check run times. At the moment I've a simple bash script that looks a little like the below - ...
DMA57361's user avatar
  • 18.7k
3 votes
1 answer
3k views

Simplest setup on Windows to send HTTP request, get and apply regex to response, and write match(es) to output file

I'd like to write a script that records the size of the close votes review queue on SO (currently ~95.5k), polling just a few times an hour, so I could plot a general trend. I know what I'm going to ...
Andrew Cheong's user avatar
3 votes
5 answers
3k views

How to run a bash script outside of a terminal?

Hey All, wrote this script to confuse my girlfriend when she is using my computer. The only trouble is that if the terminal gets closed the script stops to execute. It currently executes in the ...
sixtyfootersdude's user avatar
3 votes
2 answers
3k views

Clear the TEMP folder on shutdown

I am following some instructions in More Ways To Speed Up Windows XP to help speed up my computer. One of those was to delete the temp folder on shutdown. Yet after I shutdown and then boot up, the ...
L84's user avatar
  • 3,871
3 votes
2 answers
3k views

Shell script to rename multiple files from their parent folders name

I have a file structure like this: 00000010 000000001.file1 000000001.file2 00000020 00000003.file1 00000003.file2 00000003.file3 ... So there are folders with 8-digit names containing one ore ...
Simon's user avatar
  • 151
3 votes
1 answer
6k views

Run script at shutdown/reboot with systemd

I would like to run a script file when the system is called for shutdown/ reboot from 'reboot' and 'shutdown' commands. And if possible, also hard shutdowns like 'init 0' or 'poweroff'. How would I go ...
Wolfizen's user avatar
  • 1,232
3 votes
0 answers
3k views

Delete a directory from the Windows command line even if it's been opened in a program

I want to delete a directory with files owned by other processes in Windows 7. Other answers say to find the process that is accessing it which I do not want to do. I tried using PowerShell and ...
Max Heiber's user avatar
3 votes
4 answers
6k views

How can I move files from 2-level folders to 1-level folder

I have a bunch of files stored in a file directory as such root_folder -- folder1 --folder1_2 --bunch of files here -- folder2 --folder2_2 --bunch of files here -- ...
nic's user avatar
  • 131
3 votes
2 answers
4k views

Create keyboard shortcuts to move/resize windows in Ubuntu

On windows I have a few AutoHotkey scripts that let me hit various key combinations to resize windows to particular pre-defined sizes, or move them to certain areas of the screen (or both). I'm ...
Herms's user avatar
  • 9,642
3 votes
1 answer
4k views

Renaming files according to the folder they're in

I have hundreds of folders named after movies. In each folder there's a .mkv file (or .avi, .mp4), named differently. In each folder there's a folder.jpg. I'd like to rename each video file so that ...
Andreas's user avatar
  • 31
3 votes
3 answers
25k views

How to make an error message in a batch script if the target isn't present?

I have made a batch script template that I can program to select a given target, but I would like the script to also throw a custom error dialog if the target is not already present on the end-users ...
Mr. Mendelli's user avatar
  • 1,259
3 votes
2 answers
6k views

get the hash of a string and eventually compare it to a hash

I want to run a one-liner to enable me to get the hash of a string and eventually compare it to a hash I can just copy at the end of the command later. I'm confident I can figure out how to do the ...
user avatar
3 votes
2 answers
2k views

Run a script at logoff on XP Home?

Is this possible without having a process running continuously, listening for WM_QUERYENDSESSION or similar? (or worse still, loading a DLL into the Winlogon process) (Also unacceptable: write a ...
Hugh Allen's user avatar
  • 9,880
3 votes
5 answers
27k views

How do I check the outcome of a ftp script with a bat file? [closed]

I have a .bat file that runs a ftp script, grabbing files from the server and copying them to my machine. Works great. I now want this .bat file to report if any of these errors occured. If you ...
Tommy's user avatar
  • 669