Comments (7)
Weird. In the past, there was a problem with current working directory getting lost during elevation, resulting in wrongly resolved relative paths, but that has been fixed in d427ae7.
I'm using the presets in bat scripts normally, see eg. Win10-ApplyAll.bat from test folder.
Could you give me a specific example of your bat file?
from win10-initial-setup-script.
@echo OFF
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "Win10.ps1" -preset "Win10-Personal.preset"
All Files, Win10, the preset and the bat are in the same folder.
Double checked if they were there and renamed correctly.
I'm trying this stuff out:
https://stackoverflow.com/questions/22490785/powershell-run-script-from-shortcut-using-relative-path
from win10-initial-setup-script.
Ah, I see. That's probably just PowerShell being PowerShell. Try
powershell.exe -NoProfile -ExecutionPolicy Bypass -File ".\Win10.ps1" -preset "Win10-Personal.preset"
from win10-initial-setup-script.
do i need .\ for the argument as well?
trying in a sec
from win10-initial-setup-script.
Works.
oddly when i use this method to run other scripts as well, it works.
As soon as i run the script as admin it doesnt, any clues?
trying to run this one: https://github.com/W4RH4WK/Debloat-Windows-10/blob/master/utils/install-basic-software.ps1
from win10-initial-setup-script.
you had some "require admin" magic in there, is it because of that?
from win10-initial-setup-script.
As it turns out you actually don't need to put .\
if you have it in the -File
argument (which you do have). Only if you'd use just powershell.exe Win10.ps1
(without -File
) then you'd need to supply also .\
otherwise you get
Win10.ps1 : The term 'Win10.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program.
However I've tried just now with your line without .\
and it works for me on clean Win10 Pro 1709 (16299.125).
The other error which you might be getting is
The argument 'Win10.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.
Which you'll get when you try to launch the script while you are in different directory than the Win10.ps1 and the preset are, because the relative paths are resolved against the current working directory.
Which error are you getting?
you had some "require admin" magic in there, is it because of that?
RequireAdmin
magic is used for the auto-elevation. Regarding the presets, it just takes the relative path to the preset, resolves it and reinject as absolute path to the elevated script to prevent the error mentioned above.
from win10-initial-setup-script.
Related Issues (20)
- What are "ModernUI applications" - or how do I recognize them? HOT 5
- Transparency not being disabled on 2004 HOT 2
- Request: Disable/Enable Print Spooler Serivce. HOT 1
- Windows Defender Attack Surface Reduction Rules (ASR) HOT 1
- Wi-Fi Sense is no longer available HOT 2
- Disassembler intermintently stops when running through selected items in .preset file
- Disable Domain Firewall HOT 1
- How to find "Quick acces" and classical incon on taskbar HOT 1
- EnableActionCenter not work after DisableActionCenter HOT 3
- Open command window here
- PowerShell and ampersand issues HOT 1
- Add command option to read current settings and output as preset file
- Add short description column to the preset file
- NumLock
- Add Disable Caps Lock HOT 1
- DisableF1HelpKey completely disables F1 and F2 keys HOT 1
- How to undo these changes? HOT 3
- Consider putting all MsftBloat in separate script file HOT 1
- Administrative shares not working
- Remove photos viewer from msft bloat
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from win10-initial-setup-script.