I want to download a file to a pc from onedrive/google drive.
After some digging into this subject i found invoke-Webrequest was the best command to use in this subject.
# Download the file $zipFile = "https://xxxxxxmy.sharepoint.com/:u:/g/personal/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxfRW5c" Invoke-WebRequest -Uri $zipFile -OutFile "c:\temp\xxxxxx.exe"
only to found out the code was working but only downloaded a .exe file of 156kB
This file i wanted to download is 22mb? i get no error's in powershell but maybe you have any idea what is going on?
zipfiles work but then i need to extract a zip file in the code and i dont know the working code for that..? ( expand-archive didnt work).
So there is no login context for the session spawned by your script. If you open one drive in your browser, once authentication is established and a session exists, the browser is given access to the file.
If you open your file that is 156kb in notepad, you should find it's just a webpage saying the URL is not available.
I believe this will help the situation, but it's more complex:
https://techcommunity.microsoft.com/t5/onedrive-for-business/how-to-download-root-level-files-from-onedrive-using-powershell/m-p/758689
Thnx you for you reply and sorry for my late reply,
It turns out that the link i was using didn't have access to the file directly.
When you add in the onedrive/google docs :download=1 it will skip the "virus scan".
&download=1 needs to be added.
I'm trying to copy a single file to the "Computer Backups" folder as shown below. The command does not work, even thought the syntax is correct, i.e., "source dest file". I've tried many permutations of this command, different quoting, and still it does not work. I've also tried running it using admin privs, to no avail. My guess is that it is a quoting issue.
robocopy F:\ "C:\Users\ben\OneDrive\Computer Backups" "HP Pavillion to USB_full_b2_s1_v1.tib"
-Thanks
Never mind, the problem was that OneDrive has a file size limit, and this file is 221 GB.
Needs some help. We run PowerShell scripts using a configuration script.
e.g. .\folderA\TheConfigurationScript .\scriptThatDoesAllTheWork.ps1
The issue is that in the directory where scriptThatDoesAllTheWork.ps1 is located there are number of other scripts.
If I accidentally add a space before scriptThatDoesAllTheWork.ps1 all scripts located in that folder are executed
e.g. .\folderA\TheConfigurationScript
.\ scriptThatDoesAllTheWork.ps1
All variables therefore defined in folderA\TheConfigurationScript are available to scriptThatDoesAllTheWork.ps1 that does all the work
Is there any way to avoid this behaviour
Thanks in advance
Thanks to mclayton. I had a get-childitem that would return all the files in case of space. In case this helps anyone
After executing some simple commands like
dos('copy *.txt new.txt', '-echo')
dos('echo. 2 > EmptyFile.txt', '-echo')
I tried to delete the folder in which these files were created. However, Windows gives me the message
"cannot delete "FolderName": the folder is being used by another person/program".
I have to close Matlab to make it work.
How do I solve this? I guess it's something like closing the "session" of cmd commands...
What you're not showing is the change of working directory to your folder. Windows won't let you delete a folder that a process has as a current working directory.
The solution is simple: change the working directory out of that folder. Say:
cd('..')
I got the following error while starting JBoss from a command line prompt today:
'findstr' is not recognized as an internal or external command
Please google it, you can find a lot of answers. But do as below to fix it. Add the following value to Right Click My Compuer -> Advanced -> Environment Variables -> System Variables -> Select Path variable -> append the below value.
C:\WINDOWS\system32
It should work with that change.
As others pointed, issue is in wrong settings of PATH variable in Windows.
According to article this is most probably because some stupid installer wrongly modified PATH variable in Windows registry. Registry has 2 different string value types - REG_SZ and REG_EXPAND_SZ. Only the second one allows for expansion of %SystemRoot%.
So check your path by typing set path in command prompt. If you see unexpanded %SystemRoot% and other variables in Path, you are affected (PATH should show only plain directory names, not variables).
You need to edit Path variable in registry: HKEY_CURRENT_USER\Environment and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. As it is not possible to change the type of key, save the path value somewhere, delete the key and re-create it with type REG_EXPAND_SZ. You need to logout for changes to take effect.
for me it works when I've coped findstr(from windows/system32) to wildfly/bin
Please go throught the simplest steps:-
go to C:\Windows\system32\ and copy findstr.exe file.
paste this file into the location C:\Program Files\Java\jdk1.6.0_24\bin
Run your jboss again you will get out of this.....
Check to see if you %SystemRoot% is evaluating (type set path into a command prompt, you should not see %SystemRoot%, but instead that actual path). If your path variable's (user, or systems) first entry begins with an %(an environment variable) this can cause an issue.
To resolve this, simply swap this first entry with anything else in your path that does not lead with an environment variable.
You can also hard code the directory by replacing 'findstr' with 'C:\Windows\system32\findstr'. This is useful when using systems with restricted user permissions.
I have try to work with play framework but stuck with to run activator.bat file but solution is the same just copy file from windows/system32/findsr and past it to under stuck folder then run the respective file again.
thanks to andrewsiand Suryaprakash
Please beware that current Windows systems use a Capital "S" for the System directory, so:
C:\WINDOWS\System32
%SystemRoot%\System32
Omitting the capital S will result in a neglect of the line in the %PATH%
In my case (not JBoss related) the following helped to fixed this error.
Instead of:
SET path="%path%;C:\some\additional\path"
I used:
SET "path=%path%;C:\some\additional\path"
For IBM ACE solution for
'findstr' is not recognized as an internal or external command,
Go to the path C:\Windows\System32
Find the findstr.exe, copy it and then find the path where you bin file of your application is found. eg C:\Program Files\IBM\ACE\11.0.0.12\server\bin then past it inside the bin file
cancel the console of ace and re-open it.
Then run ACE toolkit command on ace console.
Then press enter, now it can open.