All Questions
251
questions
1
vote
1
answer
592
views
Writing a batch script to copy files based on date
I have a folder on a local PC that updates files through Dropbox. I have created a batch script that runs through a scheduler each day.
So far it checks to see if a folder is empty (C:\TheGlenFTP\...
0
votes
2
answers
85
views
Some image files are deleted during output/moving with batch file
I've been having an issue for a while now with various versions of a batch file script I have been using to assist with listing items on my WordPress/woocommerce page. The script seems to occasionally ...
0
votes
1
answer
111
views
Find letter of the system drive of most recently attached VHD
There are scripts for finding letter of most recently attached VHD here and here. I use the following code to run from batch script:
FOR /f usebackq %%a in (`powershell -c "GET-DISKIMAGE %...
3
votes
2
answers
3k
views
Extract text between two strings from a file and save the output
How to extract the text between two strings from a file and save the output to another file, and invoke it in batch, at command line?
To be more specific, let us say that the input file is SomeFile....
1
vote
1
answer
192
views
What is the equivalent of Linux's && for windows
What is the equivalent of Linux's && for windows
For example
cd\
cd rcA
powershell "ls | where {$_.Length -lt 100gb} | Remove-Item -Force -Recurse"
What to add to make the script ...
0
votes
1
answer
138
views
How to do logging after taking admission access in batch script?
I have typed the suggested solution in Log an entire batch file output.
But only work when we batch script doesn't ask for admin access or take any user input.
In my script i I'm take the ...
-1
votes
2
answers
2k
views
copy files from server share to C:\Temp and then run the batch file that is copied locally
I need a login script to copy the contents of a directory from a file share to the local computer, and then run a bat file that gets copied locally as part of that process.
if not exist "C:\Temp\&...
-1
votes
2
answers
2k
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
2
answers
392
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
348
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
1
answer
85
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
618
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
88
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 ...
0
votes
2
answers
315
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
542
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 ...