Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Powershell - "Supply Values for the following parameters"

08 Oct 2012   #1
Cancerous

Windows 7 Professional 32bit
 
 
Powershell - "Supply Values for the following parameters"

Noob to PS, but I know bash and batch.

I'm trying to do a simple script that tests the existence of a file and then creates another depending on the outcome, but prompts me for a parameter value after running it.

Code:
Code:
function test-existence {
if(test-path -path "C:\testran.flag") {echo > C:\users\admin\desktop\true.flag}
if(!(test-path -path "C:\testfailed.flag")) {echo > C:\users\admin\desktop\false.flag}
test-existence
I've tried running it as a function and just as a two line script, but it still produces the same result.

Prompt:
Quote:
Supply values for the following parameters:
InputObject[0]:
This is part of a fully automated setup so I need this to run without any user interaction.


Thanks.


My System SpecsSystem Spec
.
09 Oct 2012   #2
Ztruker

Windows 10 Pro X64
 
 

Use Add-Content:
Code:
function test-existence 
  {
    if(test-path -path "C:\testran.flag") {Add-Content C:\users\admin\desktop\true.flag ""}
    if(!(test-path -path "C:\testfailed.flag")) {Add-Content C:\users\admin\desktop\false.flag ""}
  }
test-existence
My System SpecsSystem Spec
10 Oct 2012   #3
Cancerous

Windows 7 Professional 32bit
 
 

Thanks
My System SpecsSystem Spec
.

10 Oct 2012   #4
Ztruker

Windows 10 Pro X64
 
 

You're welcome.
My System SpecsSystem Spec
Reply

 Powershell - "Supply Values for the following parameters"




Thread Tools




Similar help and support threads
Thread Forum
Changing the "minimize" "maximize" and "close" buttons of a theme
Ok so I'm using a custom visual style made by another user however I don't really like the buttons used that I mentioned above. The creator states it is acceptable to change the theme to however you like as long as you don't redistribute it anywhere. Ok so I opened up the .msstyles file (using...
Customization
Need to add "TASKBARS" (MSese for "Launchpads", "Docks" NOT "Toolbars"
My office just upgraded, and I can no longer use Windows XP. On this system, I was able to add a separate taskbar to facilitate quick access to commonly-browsed folder locations on our vast network, and another one expedited the launching of useful programs and lists. Each task on each taskbar...
General Discussion
can "power supply" be fixed/repaired
One of my PCs at home is a XP Pro machine that we use downstairs. The power supply (relatively new) seems to work the board...etc...but the power supply fan does not turn ? Have tried 'flipping' it with a stylus both while off and while power is on...but the fan will not turn. Is there a...
Hardware & Devices
Registry - "Unable to Delete all specific values."
I want ask a weird Question ... sorry if i post at wrong threads ... when i open regedit , i suddenly delete the wrong registry i want to delete , and appear this message "Unable to Delete all specific values." is that mean that registry not deleted right? is that mean that registry is safe? not...
General Discussion
Error: "exception processing message parameters 0xc000007FEFC3E718C"
Hi. I've been getting this error message: "exception processing message parameters 0xc000007FEFC3E718C" every time I shut down or log off, accompanied by "Bad Image" messages from time to time, usually concerning davhlpr.dll. I've run the System File Checker three times, and each time it...
BSOD Help and Support
Registry values for msachi and iaStorV "Start" variable
Right now my values for both HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Msahci and HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\iaStorV Start variables are set to "3" My system configuration consists of:
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 10:40.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App