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.
2,696
questions
0
votes
0
answers
6
views
Excel script (not macro) to remove carriage returns [migrated]
I am trying to write an excel online script to remove carriage returns. Writing a macro to do this is in the desktop version of excel is easy via "cntl+j" using the replace drop down. ...
1
vote
0
answers
15
views
How to save each page of a PDF file into separate files, and name them from text file of file names
I have a large PDF file, as well as a text file of file names. I'd like to use the command line to make/save one new PDF file for each page in file.pdf and name them with the file names in names.txt. ...
0
votes
1
answer
15
views
Adding a user to an ubuntu linux group within a shell script
I'm writing a bash script to set up a docker application along with configuration etc. It's intended to run in a fresh Ubuntu install and be fully automated - just hit return and wait (albeit ...
0
votes
1
answer
51
views
windows equivalent to touch [duplicate]
Is there a Windows equivalent to the touch command?
0
votes
1
answer
59
views
curl only works with -u but not with -n
I can't get where is the error
This works like a charm:
~$ curl -u 'foo@yahoo.com:123' imaps://imap.mail.yahoo.com:993 -X 'STATUS INBOX (MESSAGES)'
But this don't:
~$ curl -n imaps://imap.mail.yahoo....
-1
votes
2
answers
94
views
Getting the last 5 digits of the Microsoft Office product key with a script
When running the command cscript "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" /dstatus you get the following output (keys hidden for privacy):
Microsoft (R) Windows Script Host ...
1
vote
0
answers
27
views
How To Add VPCS To Cisco Packet Tracer 8.2.1?
I am trying to automate tasks in packet trace version 8.2.1, and I am trying to run some commands on a group of routers using a Python script as described by chatGPT. Here is the script:
# Define the ...
0
votes
0
answers
25
views
Prevent double clicked SH script from being entered into ZSH history on Mac [migrated]
I've got some SH scripts which I double click to run. The scripts run as intended, after having set the working directory via cd "$(dirname "$0")" at the beginning of the script, ...
0
votes
0
answers
39
views
Can't run Start-Process with RunAsUser from .ps1 file
Wrote a script that copies a .exe file to a folder then tries to run it as another user but the Powershel window just closes without running the .exe.
The command that runs it works fine if I run it ...
0
votes
0
answers
48
views
Is Apple Music (the app, not the service) for Windows scriptable?
Apple used to support COM as API for iTunes. AFAIK, this support has been officially dropped. Now with Apple Music for Windows on the horizon, is there any information available whether, and if so how,...
0
votes
1
answer
38
views
Autosave Notepad Command
Can we have a command for MS Windows Notepad which triggers Save after a few seconds or like 30 seconds or Save every time I close the document.
I need something that works like .LOG which logs the ...
0
votes
1
answer
31
views
Exercising clean code
I have a script that if kept on the same line, it'll be quite annoying to edit. But at the point at where I want to break line, I get the error when running,
-ApplicationParameter : The term '-...
2
votes
0
answers
34
views
I wan't to configure Windows Powershell Script execution policy precisely
Is it possible to configure the Powershell execution policy to ask the Administrator for authorization each time a Powershell script wants to run?
Something like this :
Windows Administrator ...
0
votes
0
answers
49
views
"Allow in the Background" Login items OS X Ventura Issue (NOT Notifications related)
Mac OS 13.3.1
I have a relatively simple shell script as a program argument in a LauchAgent plist that i created; it parses, loads and works just fine.
The question is, what does toggling the ...
0
votes
1
answer
72
views
Powershell script runs, but outputs an error: "The term ''$varArgs'' is not recognized as the name of a cmdlet, function, script file, or operable "
Apologies if this is a really simple thing, but I really struggle at understanding coding so I'm hoping someone can help me. I have the relatively simple Powershell script. It seems to run, but for ...
1
vote
1
answer
49
views
How can one detect an active WebRTC connection on the Mac programmatically?
What would be the cleanest way to infer that a WebRTC connection is either being established or is active.
e.g. maybe there is a way to query the browser, or can one tell by actively monitoring ...
0
votes
0
answers
19
views
How to insert OBS's current recording time into OneNote?
I'm Looking for a way to automatically insert OBS's current recording time into OneNote. Is there a way to do that out of the box?
If not, what's the easiest way to do that?
I tried writing a Lua ...
1
vote
2
answers
40
views
WMIC ProcessID does not get parsed within the same command instance
I've got a batch script that I'd like to capture its Process ID but the PID is not being parsed from within the same command instance.
For example, running the batch script with the following code ...
0
votes
1
answer
46
views
Checking if OneDrive is started before running script fails
I'm trying to create a bat script that checks if OneDrive is running, and if OneDrive is not running OneDrive.exe will be started.
I have 2 issues:
If OneDrive is running, it will close the cmd window ...
0
votes
2
answers
57
views
How to open simultaneous SSH sessions to 100 elements when server permits only 10 elements per session?
I am running a script to simultaneously run SSH sessions to 100 elements but my server can only permit 10 elements to be accessed at a time. My script is like below:
cat ip | while read ip
do
...
0
votes
0
answers
17
views
Backup copy from iCloud shows error cloud provider is not running when VPN is turned on
I've made a backup script which (amongst other operations) copies my iCloud photos directory to a separate location. This script will run every time I log in to my computer.
Some time ago I purchased ...
0
votes
0
answers
64
views
Assign a FOR variable to an Argument/Parameter
Is it not possible to use a FOR variable, like %%a, and assign it to an argument/parameter, like so:
for /L %%a in (0,1,5) do (
echo Argument#(%%a) is %~%%a
)
0
votes
2
answers
119
views
Registry Query for batch script
I am trying to create a batch script, (only specifically batch script), to check if the latest Microsoft Office version is installed to my computer. If it detects the latest version, it will output ...
0
votes
0
answers
42
views
Upgrade powershell version 2.0 to version 4.0+ using cmd or powershell
I have a problem, I work in a large organization we have several computers with windows 7 and many of them are very old versions, and come with a powershell 2.0.
I was creating some scripts to solve ...
0
votes
0
answers
62
views
Trying to Echo Array Values by Referencing the Array.Length Variable
I'm trying to output the contents of an array index # by referencing the index # using the A1.length value. But since I still don't fully understand the expansion of variables, the most I get for ...
1
vote
1
answer
133
views
Log in as different user during PowerShell script, but keeping the script going on same console window
so I am using PowerShell to create a Menu to host all of my smaller scripts but there are a few that require elevated rights, which I do have. I'm also wanting the dev team to be able to use this so ...
1
vote
1
answer
80
views
Can I and how to use `script` in a bash script
This must be the most frustrating research I've ever attempted (so far). So, there is script(1). I've been trying to add it to the start of a bash script I have (I was looking for a way to log every ...
0
votes
1
answer
30
views
How to get a results ouput file from running a copy operation against a server list?
We have a batch file that we use to (robo)copy scripts to various computers on our network.
We need be able to write the result of the copy operation (success or fail) to an output file including the ...
1
vote
1
answer
189
views
How to execute "source" command inside a shell script and then store the output of source in a variable within the shell script?
I have written a shell script (called profile.sh) to fetch temperature values from the Android MPSoC. Separately, I have found a shell script that fetches the FPS of an app on the Android system as ...
0
votes
1
answer
647
views
Is it possible to remove cURL command?
I am a new Tier2, Tier3 is requesting I attempt to write a script to remove the curl command from student PC's, is this possible? Should I suggest disabling curl via AD group policy?
1
vote
1
answer
64
views
stopping ssh process that is sent to background without corrupting stdout
My script aims to extract a text log file using tail -f and a wireshark trace using tshark. But I don't know if these are the best options for my goal.
My script has to ssh into a machine (which I ...
1
vote
2
answers
26
views
How to automate stopping a program at bootup, not removing it from bootup
Okay folks I want your help to be a bad, but only a little bad!
My work has an annoying program that displays which machine I'm running on, so as not to confuse different type's of computers. I know ...
0
votes
1
answer
98
views
Detect displays in Windows 10 without opening settings (using a script command?)
When I lock or sleep my computer and unlock it again later, one of my three monitors does not always turn on. Settings -> Display has a "Detect" button that turns on all monitors handily (...
0
votes
0
answers
32
views
Script to mount files local to gdrive
I have that kind of script which worked with virtual box but now I did not know about the new Mounttype ?
Here the script :
#!/bin/sh
#
# mount & copy - Mount the Virtualbox shared folder and ...
1
vote
1
answer
42
views
Why is this dot command behaving differently from the source command for the same script?
According to bash man pages and other online sources, the source command and dot should behave in exactly the same way when sourcing an existing script, but that is not what I observe. Consider this ...
0
votes
1
answer
168
views
How to run a script at logon/logoff of one specific user in Windows 10 without using GPO?
I have a set of computers which are used by several users. One one of those computers I need to map a drive for two users (and only for those two users).
My idea was to run a script on logon of either ...
0
votes
1
answer
155
views
Restore previous folder windows after restarting explorer.exe [duplicate]
How can I Restore previous folder windows after restarting explorer.exe?
I thought about saving the current folder position/folder path and retrieve/open it after the explorer restart?
For example, if:...
0
votes
1
answer
85
views
Single vs Multi Line: Different results after setting variables, and Only if parameters are passed from command
Why do these two sets of code-blocks give different results when everything is the same, except for the structure of the IF Statement? Interestingly, the only time the result fails is when I pass the ...
1
vote
2
answers
446
views
How to change mouse cursor using powershell script on windows 11 without restarting?
I am having some hard time trying to change mouse cursor using PowerShell script on windows 11.
I have this application called WDD scripts which have the power of PowerShell scripts depending on the ...
0
votes
0
answers
31
views
disbale user in usermanager mikroitk
I have Mikrotik version 6 and my users are connected to usermanager and use internet. I want to disable all users in usermanager for one hour and then activate it with another script.
1
vote
2
answers
193
views
Duplicate Results from Batch File
I created a batch file that gives me the ability to input a computer name and it will tell me who is logged into the device as well as the serial number of that device. I pull these two specific bits ...
0
votes
0
answers
138
views
Mac Ventura 13.2 Show Current Resolution of Main Display
How can I use AppleScript or Terminal to ascertain the current resolution of the main display if I have two? Currently, main display is 2021 MacBook Pro 16" (Silicon, M1) and extended display is ...
0
votes
1
answer
74
views
Need to iterate Backwards in a linux/unix path
I have a script that would have multiple paths (folder names).
Each folder path would have a Dockerfile, but its uncertain at what level that file would exist.
Lets say my path is "v1/airflow/1....
1
vote
0
answers
304
views
how to script tmux to execute a script in a tmux session(window)
I have this script:
#!/bin/sh
tmux new-session top \; split-window -v \; split-window -h \; select-pane -t 0 \; split-window -h \; attach-session
I would like to execute a shell script in each ...
0
votes
1
answer
216
views
How to delete a line based on a regex string in Powershell?
I want to validate if the line above a certain line is there, then ok. if else, then delete that line and remove the empty space ? Can this be done in powershell? please help
If before all lines ...
1
vote
1
answer
98
views
Is there a way to easily compare driver versions between computer A and computer B?
I have a gold standard machine that contains all the correct drivers and I want to know if there is an easy way to compare the driver version between computer A and computer B (both with identical ...
1
vote
2
answers
294
views
Add header efficiently to a large CSV file using PowerShell
I need to add headers to a large CSV file (900+MB) but PowerShell stalls for 3 hours+ on my system and sometimes even crashes.
Question: Is there a way to stream the data through instead of loading ...
0
votes
1
answer
60
views
Run batch file in over 100 subfolders of a parent directory
I have to specify that am literally 3 days into scripting and batching. I have a hard time understanding many functions and there variations.
The batch script below should allow me to export .shp ...
2
votes
1
answer
203
views
Sort files into folders by file name according to a spreadsheet of names
I am a teacher and use Canvas-LMS for my course. The course is broken into smaller groups led by individual teaching assistants, who grade student assignments in their own section. Canvas only ...
1
vote
2
answers
39
views
Trying to colour code the output of tracert within powershell - not working as expected
I'm trying to colour the lines green, yellow and red within powershell depending on the latency in milliseconds. Our remote workflow dictates that anything over 40ms is bad, so I want this to be ...